MCPcopy Create free account
hub / github.com/BeeBombshell/Python-DSA / heapSort

Function heapSort

Sorting Algorithms/heapSort.py:25–35  ·  view source on GitHub ↗
(arr)

Source from the content-addressed store, hash-verified

23
24#function heapsort to sort
25def heapSort(arr):
26 n = len(arr)
27
28 #build the maxheap.
29 for i in range(n//2 - 1, -1, -1):
30 heapify(arr, n, i)
31
32 #extracting the elements
33 for i in range(n-1, 0, -1):
34 arr[i], arr[0] = arr[0], arr[i]
35 heapify(arr, i, 0)
36
37
38#---main program--

Callers 1

heapSort.pyFile · 0.85

Calls 1

heapifyFunction · 0.85

Tested by

no test coverage detected