Median Finding : Implement the following order statistics algorithms : a. Median of groups of 3,5 and
Fantastic news! We've Found the answer you've been seeking!
Question:
Median Finding :
Implement the following order statistics algorithms :
a. Median of groups of 3,5 and 7.
b. Randomized median finding algorithm.
Make your code generic enough so that it can answer order statistics for any k. For example, k = n/2 gives the median and k=n gives the max.
Quick sort :
Implement quicksort where the pivot is chosen from the previous order statistics algorithms. Compare the performance of quicksort with median as pivot with randomized quicksort which chooses a random element in the array as the pivot.
code in python
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date: