+1 (218) 451-4151
glass
pen
clip
papers
heaphones

We can make the quick-select algorithm deterministic, by choosing the pivot of an n-element…

We can make the quick-select algorithm deterministic, by choosing the pivot of an n-element…

We can make the quick-select algorithm deterministic, by choosing the pivot of an n-element sequence as follows:Show that this deterministic quick-select algorithm runs in O(n) time by answering the following questions (please ignore floor and ceiling functions if that simplifies the mathematics, for the asymptotics are the same either way):a. How many baby medians are less than or equal to the chosen pivot? How many are greater than or equal to the pivot? b. For each baby median less than or equal to the pivot, how many other elements are less than or equal to the pivot? Is the same true for those greater than or equal to the pivot? c. Argue why the method for finding the deterministic pivot and using it to partition S takes O(n) time. d. Based on these estimates, write a recurrence equation to bound the worstcase running time t(n) for this selection algorithm (note that in the worst case there are two recursive calls—one to find the median of the baby medians and one to recur on the larger of L and G). e. Using this recurrence equation, show by induction that t(n) is O(n).