MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / pop

Method pop

data_structures/heap/max_heap.py:53–60  ·  view source on GitHub ↗

Pop the root element

(self)

Source from the content-addressed store, hash-verified

51 i = bigger_child
52
53 def pop(self) -> int:
54 """Pop the root element"""
55 max_value = self.__heap[1]
56 self.__heap[1] = self.__heap[self.__size]
57 self.__size -= 1
58 self.__heap.pop()
59 self.__swap_down(1)
60 return max_value
61
62 @property
63 def get_list(self):

Callers 1

max_heap.pyFile · 0.45

Calls 1

__swap_downMethod · 0.95

Tested by

no test coverage detected