# Computer Science (Sorting)

**Question description**

For each problems segment given below, do the following and write your answers in assign5.txt:

Create an algorithm to solve the problem (describe it in English as part of your answer).

Identify the factors that would influence the running time, and which can be known before the algorithm or code is executed. Assign names (such as

*n*) to each factor.Identify the operations that must be counted.

Count the operations performed by the algorithm or code. Express the count as a function of the factors you identified in Step 2. If the count cannot be expressed as a simple function of those factors, define the bounds that can be placed on the count: the best case (lower bound) and worst case (upper bound).

Determine what the Best Case Inputs are, and the Worst Case Inputs are.

Transform your count formula into big-O notation by:

Taking the efficiency with worst case input,

Dropping insignificant terms.

Dropping constant coefficients.

a. Determine if 2 arrays contain the same elements in the same order

b. Counting total number of characters that have a duplicate within a string (i.e. "gigi the gato" would result in 3, since g, i, and t are repeated.)

c. Finding an empty row in a 2-D array where empty is defined as a row with all entries equal to 0.

## Tutor Answer

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors