Question: Problem 4 . Suppose that we modify Partition so that it chooses the minimum element as the pivot that occur in nodes of the recursion
Problem Suppose that we modify Partition so that it chooses the minimum element as the pivot that occur in nodes of the recursion tree whose depth is divisible by and it chooses the median element as the pivot in calls that occur in nodes all other depth of this recursion tree.
Assume that the running time of this modified Partition is still Thetan on any subarray of length n And the root of a recursion tree starts at level which is divisible by its children are at level etc.
For example, the modified Partition chooses the median element at the root of the recursion tree, in the next layer of the recursion tree it chooses the minimum element, and so on
Write a recurrence relation for the running time of modified Quicksort given an array n distinct elements. The final recurrence relation is sufficient, no need to solve it asymptotically.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
