Homework problems D and E

Problem D

Assigned Sept 16, due Sept 30.

This problem is CLR problem 7-3. You may base your answer on the code there or on the stoogeSort in ~saunders/621/stoogeSort.h.

  1. Show it is correct. Hint 1: Use induction. Prove that if the recursively called sorts work correctly then the calling sort works correctly. Hint 2: Where are the k largest elements after the first recursive sort? Where are they after the second sort? Note that the first and third sections are k long and the middle section contains at least k elements.
  2. Give recurrence and solution for the worst case run time T(n).
  3. Find numbers d and e such that nd is O(T(n)) and T(n) is O(ne, and e - d < .01. You may wish to use maple: Run command `maple'. After a startup delay you will get a prompt. For instance, you can use an expression like `evalf(log[b](a));' to get the value of log base b of a.

Problem E

Assigned Sept 18, due Oct 7. [corrected from Oct 2]

This problem is CLR exercise 7.3-2 on page 154.