Analyzing Quicksort: Average Case
Assuming random input, average-case running time is much closer to O(n lg n) than O(n2)
First, a more intuitive explanation/example:
- Suppose that partition() always produces a 9-to-1 split. This looks quite unbalanced!
- The recurrence is thus:
T(n) = T(9n/10) + T(n/10) + n
- How deep will the recursion go? (draw it)
Use n instead of O(n) for convenience (how?)