Random pivot · in-place partition · recursion · live comparison count
| Case | Time | Why |
|---|---|---|
| Best | O(n log n) | balanced partitions |
| Expected (any input) | O(n log n) | ~1.39 n log₂ n comparisons; random pivot |
| Worst (theoretical) | O(n²) | unlucky pivot streak; probability → 0 |
| Space | O(log n) | recursion stack (expected) |
| Stable | No | partition can reorder equal keys |
| Correctness | Always | Las Vegas: only runtime is random |