Analysis of Quicksort
- The partition routine is called at most one time for each element
- All comparisons are done inside the partition routine
- Therefore algorithm runtime is O(n + x), where x is the total
number of comparisons made by the partition routine
- Worst case: x = Θ(n2)
- Average case: E[x] <= O(n log n)
|