CombSort

Comb Sort.

An improvement over Bubble Sort that eliminates turtles (small values near the end) by using a shrinking gap between compared elements. Gap shrinks by a factor of 1.3 each pass until it reaches 1, at which point it behaves like Bubble Sort.

Functions

Link copied to clipboard
fun <T : Comparable<T>> sort(array: Array<T>)

Sorts the array in ascending natural order.

fun sort(array: IntArray)

Sorts an IntArray in ascending order.

fun <T> sort(array: Array<T>, comparator: Comparator<T>)

Sorts the array using the given comparator.