(2 points) Suppose I have an unsorted array of integers with a size of .

  1. Write the pseudocode for a recursive algorithm that finds the maximum element in the array.
  2. What is the time-complexity (Big-) for your recursive algorithm? Prove your answer.

(5 points) Consider the Harmonic numbers, given by the series and recursion relation shown below.

  1. What is the value of ?
  2. Write the pseudocode for a recursive algorithm that calculates the nth Harmonic number.
  3. Sketch out a recursive trace of your function when the argument is used. Use the example of the recursive trace from your textbook as a template.
  4. Is your algorithm an example of linear, binary, or multiple recursion? Why?
  5. Prove that your recursive algorithm has a time complexity of O(n).

(1 point) An algorithm is defined by the following recurrence relation. Use the substitution method to prove that this algorithm is .


(1 point) An algorithm is defined by the following recurrence relation. Use the Master Theorem to show that this algorithm is .


(1 point) You are given an unsorted array consisting of random integers. Write the pseudocode for a function that takes the array as an argument and returns a new array that only contains the positive integers from the original array. It should be a tail-call optimized recursive algorithm.