MCPcopy Create free account
hub / github.com/geekcomputers/Python / heapSort

Function heapSort

heap_sort.py:30–41  ·  view source on GitHub ↗
(arr)

Source from the content-addressed store, hash-verified

28
29# Main function
30def heapSort(arr):
31 n = len(arr)
32
33 # Make a heap
34 for i in range(n // 2 - 1, -1, -1):
35 refineHeap(arr, n, i)
36
37 # Extract elements individually
38 for i in range(n - 1, 0, -1):
39 # Fancy notation for swapping two values in an array
40 arr[i], arr[0] = arr[0], arr[i]
41 refineHeap(arr, i, 0)
42
43
44# Code that will run on start

Callers 1

heap_sort.pyFile · 0.70

Calls 1

refineHeapFunction · 0.85

Tested by

no test coverage detected