Quick Sort vs Comb Sort
Across our 3 test inputs, Quick Sort needed 106 comparisons in total versus 132 for Comb Sort. On average Quick Sort runs in O(n log n) time and Comb Sort in O(n² / 2ᵖ).
Head-to-head on identical inputs (comparisons)
| Input | Quick Sort | Comb Sort |
|---|---|---|
| Random order | 22 | 50 |
| Nearly sorted | 39 | 41 |
| Reversed | 45 | 41 |
Complexity
| Quick Sort | Comb Sort | |
|---|---|---|
| Average time | O(n log n) | O(n² / 2ᵖ) |
| Worst time | O(n²) | O(n²) |
| Space | O(log n) | O(1) |
| Stable | No | No |
When to use Quick Sort
General-purpose sorting. Fast in practice due to excellent cache locality. Default algorithm used in many language libraries (often hybridised as Introsort).
When to use Comb Sort
A simple, low-memory improvement over Bubble Sort for small-to-medium arrays.