NIST

comb sort

(algorithm)

Definition: An in-place sort algorithm that repeatedly reorders different pairs of items. On each pass swap pairs of items separated by the increment or gap, if needed, and reduce the gap (divide it by about 1.3). The gap starts at about 3/4 of the number of items. Continue until the gap is 1 and a pass had no swaps.

Generalization (I am a kind of ...)
diminishing increment sort.

See also bubble sort, Shell sort.

Note: Bubble sort can be seen as a variant of comb sort where the gap is always 1. Since items may move large distances at first, comb sort is quite efficient.

Comb sort does a single "bubbling" pass (ala bubble sort) over each set for each gap or increment, whereas Shell sort completely sorts each set. J. Incerpi and R. Sedgewick (1985) point out that bidirectional "bubbling" (ala bidirectional bubble sort) is more symmetric than the typical comb sort.

Author: PEB

Implementation

(Python).

More information

W. Dobosiewicz, An efficient variation of bubble sort, Information Processing letters 11(1):5-6, 1980.
Richard Box and Stephen Lacey, A fast, easy sort, Byte, 16(4):315-ff, April 1991.


Go to the Dictionary of Algorithms and Data Structures home page.

If you have suggestions, corrections, or comments, please get in touch with Paul Black.

Entry modified 21 April 2022.
HTML page formatted Thu Apr 21 14:52:02 2022.

Cite this as:
Paul E. Black, "comb sort", in Dictionary of Algorithms and Data Structures [online], Paul E. Black, ed. 21 April 2022. (accessed TODAY) Available from: https://www.nist.gov/dads/HTML/combSort.html