Comb Sort

Comb Sort Animation



Comb Sort Infographic


Methodology

Comb Sort is a hybrid sorting algorithm based on Bubble Sort.

Setup:

  • Pick Divisor Factor (DF) as 1.3

  • Let Gap Size (GS) be initial number of elements

Repeat while GS >= 1:

  • Update GS

    • GS = floor(GS / DF)

  • Select indices by skipping GS elements

  • Bubble Sort elements at selected indices


Complexity

Time Complexity (Worst): N^2

Time Complexity (Best): N log(N)

Space Complexity: 1

Unstable


Previous
Previous

Shell Sort

Next
Next

Heap Sort