4 Assume Algorithm Finds Median N Elements Cn Lg Lg N N Comparison Steps Constant C Give Q37096529

4. Assume you have an algorithm that finds the median of nelements in cn lg lg n−n comparison steps (for some constantc).

(a) Give an efficient (recursive) algorithm for selection basedon this. It will, of course, not be linear time.

(b) Write a recurrence for the number of comparisons youralgorithm uses.

(c) Solve the recurrence using constructive induction. Just getthe high order term exactly.

(d) Why might it be a good algorithm despite not being lineartime?


Answer


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.