MCPcopy Index your code
hub / github.com/OmkarPathak/pygorithm / insert

Method insert

pygorithm/data_structures/heap.py:37–44  ·  view source on GitHub ↗

inserting an element in the heap

(self, data)

Source from the content-addressed store, hash-verified

35 return (idx * 2) + 2
36
37 def insert(self, data):
38 """
39 inserting an element in the heap
40 """
41 # TODO: Fix this if we want this compatible with 2.7
42 super().enqueue(data)
43 if self.rear >= 1: # heap may need to be fixed
44 self.heapify_up()
45
46 def heapify_up(self):
47 """

Callers 1

test_heapMethod · 0.95

Calls 2

heapify_upMethod · 0.95
enqueueMethod · 0.80

Tested by 1

test_heapMethod · 0.76