Basic Idea

To avoid getting slammed with a worst-case input, we're going to pick our pivots randomly from the set of possible pivots.

Caveat: Our analysis will assume that elements in the list are distinct so there are no tie-breaking issues on the final position of the pivot. If we define the algorithm properly, duplicate elements in the list only help, so we ignore this case here.


next up previous
Next: Code Up: RANDOMIZED QUICKSORT Previous: RANDOMIZED QUICKSORT