Merge Sort vs Comb Sort
Across our 3 test inputs, Merge Sort needed 59 comparisons in total versus 132 for Comb Sort. On average Merge Sort runs in O(n log n) time and Comb Sort in O(n² / 2ᵖ). Merge Sort is stable; Comb Sort is not.
Head-to-head on identical inputs (comparisons)
| Input | Merge Sort | Comb Sort |
|---|---|---|
| Random order | 25 | 50 |
| Nearly sorted | 19 | 41 |
| Reversed | 15 | 41 |
Complexity
| Merge Sort | Comb Sort | |
|---|---|---|
| Average time | O(n log n) | O(n² / 2ᵖ) |
| Worst time | O(n log n) | O(n²) |
| Space | O(n) | O(1) |
| Stable | Yes | No |
When to use Merge Sort
When stable sorting is strictly required and O(n) extra space is acceptable. Highly predictable performance (always O(n log n)).
When to use Comb Sort
A simple, low-memory improvement over Bubble Sort for small-to-medium arrays.