Stanford CS161 Lecture 5: Proving Randomized QuickSort's Expected Time
Randomized QuickSort has O(n log n) expected time on every fixed input but Θ(n²) worst-case time. The valid proof does not substitute expected subproblem sizes into a recurrence; it computes the probability that each pair is compared.