As we can choose median of 3 element partitioning to implement quick sort. Likewise can we choose median of 5, 7, or 11 element to implement quick sort? If so, then how??
As we can choose median of 3 element partitioning to implement quick sort. Likewise
Share
You should look into the Median of Medians algorithm. It is a linear time algorithm with the following recurrence…
… which is O(n). The algorithm details…
… and some pseudo-code…
References
I hope this helps.
Hristo