MCPcopy Create free account
hub / github.com/0xAX/go-algorithms / CombSort

Function CombSort

sorting/comb_sort.go:7–22  ·  view source on GitHub ↗

* * Comb sort - https://en.wikipedia.org/wiki/Combsort */

(arr []int)

Source from the content-addressed store, hash-verified

5 */
6
7func CombSort(arr []int) {
8 tmp := 0
9 arrLen := len(arr)
10 gap := arrLen
11 for gap > 1 {
12 gap = gap * 10 / 13 //shrink factor is 1.3
13
14 for i := 0; i+gap < arrLen; i++ {
15 if arr[i] > arr[i+gap] {
16 tmp = arr[i]
17 arr[i] = arr[i+gap]
18 arr[i+gap] = tmp
19 }
20 }
21 }
22}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected