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

Method insert

data_structures/heap/min_heap.py:117–121  ·  view source on GitHub ↗
(self, node)

Source from the content-addressed store, hash-verified

115 return x
116
117 def insert(self, node):
118 self.heap.append(node)
119 self.idx_of_element[node] = len(self.heap) - 1
120 self.heap_dict[node.name] = node.val
121 self.sift_up(len(self.heap) - 1)
122
123 def is_empty(self):
124 return len(self.heap) == 0

Callers

nothing calls this directly

Calls 2

sift_upMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected