Lecture 2 - Problems

Goals

For each of the following algorithms, give its worst-case and best-case asymptotic runtime class.

  1. Let n = side_length and give your answer in terms of n.

  2. Give your answer in terms of n.

  3. Let n = A.length and give your answer in terms of n.

  4. Give your answer in terms of n.

  5. Let n = height and give your answer in terms of n.

  6. Assume that this method has access to the linearSearch method we’ve discussed. Let m = A.length and give your answer in terms of n and m.

  7. Let n = side_length and give your answer in terms of n.

  8. Give your answer in terms of n.