Question: Suppose we have a version of quick sort which selects pivots using the median-of-three strategy and creates partitions in the manner described in lecture. Explain

Suppose we have a version of quick sort which selects pivots using the median-of-three strategy and creates partitions in the manner described in lecture. Explain how you would build an input array that would cause this version of quick sort to run in O (n 2 ) time. Your answer should explain on a high level what your array would look like and what happens when you try running quick sort on it. You do not need to give a specific example of such a array, though you may if you think it will help make your explanation more clear.

Step by Step Solution

3.49 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To understand how we can create an input array that will cause the medianofthree version of quicksort to run in On2 time we first need to know how the ... View full answer

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 Programming Questions!