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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!