MCPcopy Index your code
hub / github.com/Jack-Lee-Hiter/AlgorithmsByPython / buildHeap

Method buildHeap

BinaryHeap.py:49–56  ·  view source on GitHub ↗
(self, alist)

Source from the content-addressed store, hash-verified

47 return retval
48
49 def buildHeap(self, alist):
50 i = len(alist) // 2
51 self.currentSize = len(alist)
52 self.heapList = [0] + alist[:]
53 while (i > 0):
54 self.percDown(i)
55 i = i - 1
56 return self.heapList
57
58H = BinHeap()
59print(H.buildHeap([9, 6, 5, 2, 3]))

Callers 1

BinaryHeap.pyFile · 0.80

Calls 1

percDownMethod · 0.95

Tested by

no test coverage detected