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

Function HeapSort

sorting/heap_sort.go:35–49  ·  view source on GitHub ↗
(arr []int)

Source from the content-addressed store, hash-verified

33}
34
35func HeapSort(arr []int) {
36 i := 0
37 tmp := 0
38
39 for i = len(arr) / 2 - 1; i >= 0; i-- {
40 arr = sift(arr, i, len(arr))
41 }
42
43 for i = len(arr) - 1; i >= 1; i-- {
44 tmp = arr[0];
45 arr[0] = arr[i];
46 arr[i] = tmp;
47 arr = sift(arr, 0, i);
48 }
49}

Callers

nothing calls this directly

Calls 1

siftFunction · 0.85

Tested by

no test coverage detected