COMP 731 - Assignment 2 - Due Thursday, 13 July 2000

  1. Prove that if f is Theta(n) and g is O(n) then f+g is Theta(n).

  2. Find a sequence of 10 integers such that Mergesort takes the maximal number of possible comparissons to sort your sequence of numbers. Now do it for 15 numbers.

  3. We have described two different procedures to build a heap: repeated insertion, starting from the empty heap; and fixing up each subtree, processing elements n, n-1, ..., 2, 1. Do these two methods always result in same heap? Prove that the do, or provide a counterexample to show that the do not.

  4. Solve the following recurrence relations to within Theta() accuracy. Assume T(n) = Theta(1) for sufficiently small n.
    1. T(n) = 5T(n/5) + n - lg n
    2. T(n) = 2 T(n/2) + n lg n
    3. T(n) = n T(n-1)
    4. T(n) = n + T(n-1)
    5. T(n) = n^2 + T(n-1)