Expected Case?

This analysis doesn't really tell us what to expect. In practice, quicksort behaves like a fast $n \log n$ algorithm, but our focus on worst-case running time tells us it's n2.

What gives?

The fact of the matter is, we can always force this version of quicksort to take quadratic time by a careful choice of input. Like?

In general, any deterministic scheme for picking the pivot is susceptible to being manipulated into consistently bad splits.


next up previous
Next: Rock, Paper, Scissors Up: PROBLEM WITH QUICKSORT Previous: Analysis