Question: The median - of - medians algorithm for selecting the kth smallest element in an array A [ 1 , n ] is as follows.

The median-of-medians algorithm for selecting the kth smallest element in an array A[1, n] is as follows. Divide A into n/5 subarrays, each of size 5, then get the medians of these subarrays and find the median of these medians (call it x). Using x as the pivot, we partition the elements in A into two subarrays and continue the recurrence in only one of the subarrays. This leads to a linear time algorithm. Instead of 5, if we choose 7, what will be the resulting time complexity? Also, analyze the complexity when 3 is chosen instead of 5.

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!