Question: In class, we saw a deterministic O(n) time algorithm to compute the kth smallest element in an unsorted array S of n numbers. The main

 In class, we saw a deterministic O(n) time algorithm to compute

In class, we saw a deterministic O(n) time algorithm to compute the kth smallest element in an unsorted array S of n numbers. The main idea to get the linear time algorithm was to find a good pivot element. This was done by partitioning the array S into n/5 sets of size 5. Then computing the median of each of these sets of size 5, resulting in a set of n/5 medians. The pivot element is the median of these n/5 medians and is computed recursively. What if we partition the array S into n/3 elements of size 3, instead. (a How many elements are guaranteed to be smaller than the pivot and how many are guaranteed to be larger than the pivot? Explain your reasoning (you do not need to give a formal proof). Give the recurrence for the new running time of the algorithm. Solve the recurrence using any method of your choice and state the running time of the algorithm in terms of n using Big-0h notation

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!