MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / getMax

Method getMax

data_structures/heap/heap.py:47–56  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

45 self.maxHeapify(i)
46
47 def getMax(self): #This function is used to get maximum value from the heap.
48 if self.currsize >= 1:
49 me = self.h[0]
50 temp = self.h[0]
51 self.h[0] = self.h[self.currsize-1]
52 self.h[self.currsize-1] = temp
53 self.currsize -= 1
54 self.maxHeapify(0)
55 return me
56 return None
57
58 def heapSort(self): #This function is used to sort the heap.
59 size = self.currsize

Callers

nothing calls this directly

Calls 1

maxHeapifyMethod · 0.95

Tested by

no test coverage detected