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)

InputQuick SortComb Sort
Random order2250
Nearly sorted3941
Reversed4541

Complexity

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

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.