# Computer Science (Sorting)

*label*Computer Science

*timer*Asked: Jul 27th, 2015

**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.