Algorithms and Data Structures · Middle · Question 4 of 75
Why is quicksort often faster than merge sort in practice despite the same O(n log n) average?
- 1It's stable, so it skips moving equal elements
- 2It does fewer comparisons in the worst case
- ✓Correct answer: It sorts in place and accesses memory sequentially
Explanation
Partitioning works inside the array with good cache locality and small constants. Its worst case is actually worse (O(n²)), and the usual in-place version is not stable.