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.
- 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.
- Give recurrence and solution for the worst case run time T(n).
- 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.