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)

InputMerge SortComb Sort
Random order2550
Nearly sorted1941
Reversed1541

Complexity

Merge SortComb Sort
Average timeO(n log n)O(n² / 2ᵖ)
Worst timeO(n log n)O(n²)
SpaceO(n)O(1)
StableYesNo

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.