Presentation is loading. Please wait.

Presentation is loading. Please wait.

QuickSort Choosing a Good Pivot Design and Analysis of Algorithms I.

Similar presentations


Presentation on theme: "QuickSort Choosing a Good Pivot Design and Analysis of Algorithms I."— Presentation transcript:

1 QuickSort Choosing a Good Pivot Design and Analysis of Algorithms I

2 QuickSort: High-Level Description

3 Tim Roughgarden The Importance of the Pivot

4 Template vertLeftWhite2 Not enough information to answer question Suppose we implement QuickSort so that ChoosePivot always selects the first element of the array. What is the running time of this algorithm on an input array that is already sorted?

5 Template vertLeftWhite2 Not enough information to answer question Suppose we run QuickSort on some input, and, magically, every recursive call chooses the median element of its subarray as its pivot. What’s the running time in this case?

6 Tim Roughgarden Random Pivots

7 Tim Roughgarden Average Running Time of QuickSort


Download ppt "QuickSort Choosing a Good Pivot Design and Analysis of Algorithms I."

Similar presentations


Ads by Google