← Back to Gallery

Comb Sort

Comparisons:0
Swaps:0
Array Accesses:0
Pass:0
Status:Ready

Comb Sort

Improves on bubble sort by comparing elements far apart, then reducing the gap by a shrink factor of 1.3. This kills "turtles" (small values near the end) that make bubble sort slow.

Worst:   O(n²)
Average: O(n²/2^p) ≈ O(n log n)
Best:    O(n log n)
Space:   O(1)

Watch the arcs: wide gaps shrink to 1, turning into bubble sort for the final cleanup.