Skip to content
Sortingcore

Comb Sort

Improves on bubble sort by comparing elements a shrinking "gap" apart (divided by ~1.3 each pass) before finishing with a gap of one. The large initial gaps kill turtles early, giving near-O(n log n) behaviour in practice.

Best
O(n log n)
Average
O(n² / 2^p)
Worst
O(n²)
Space
O(1)
Stable
No