## Intuitively, a real-life run of quicksort will produce a mix of “bad” and “good” splits

- Randomly distributed among the recursion tree
- Pretend for intuition that they alternate between best-case (n/2 : n/2) and worst-case (n-1 : 1)
- What happens if we bad-split root node, then good-split the resulting size (n-1) node?
- We end up with three subarrays, size 1, (n-1)/2, (n-1)/2
- Combined cost of splits = n + n -1 = 2n -1 = O(n)
- No worse than if we had good-split the root node!

Previous slide | Next slide | Back to first slide | View graphic version |