Question: Problem 2: In class we saw that comparison-based sorting algorithms must always make ( n log n ) comparisons to sort an array of n
Problem 2: In class we saw that comparison-based sorting algorithms must always make (nlogn) comparisons to sort an array of n elements.
Prove that any comparison-based algorithm must make (n) comparisons to find the median of an array of n elements.
Hint: One possible way to solve this problem is to assume that there is an algorithm that finds the median with o(n) comparisons and derive a contradiction.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
