Preview

We can use this insight to adapt quicksort so that it has the same sort of behavior.

We will pick our pivot randomly.

Sometimes this will lead to a bad split, and sometimes to a good split, but no one can force a bad split.

This will lead to an algorithm with expected running time of $\Theta(n \log n)$.


next up previous
Next: PROBABILITY THEORY Up: PROBLEM WITH QUICKSORT Previous: Importance of Being Random