File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
pygorithm/data_structures Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 7
7
# min-heap implementation as priority queue
8
8
class Heap (Queue ):
9
9
def parent_idx (self , idx ):
10
- return idx / 2
10
+ return idx // 2
11
11
12
12
def left_child_idx (self , idx ):
13
13
return (idx * 2 ) + 1
@@ -16,7 +16,7 @@ def right_child_idx(self, idx):
16
16
return (idx * 2 ) + 2
17
17
18
18
def insert (self , data ):
19
- super (Heap , self ).enqueue (data )
19
+ super ().enqueue (data )
20
20
if self .rear >= 1 : # heap may need to be fixed
21
21
self .heapify_up ()
22
22
@@ -41,7 +41,7 @@ def heapify_up(self):
41
41
42
42
def pop (self ):
43
43
''' Removes the lowest value element (highest priority, at root) from the heap '''
44
- min = self .dequeue ()
44
+ min = super () .dequeue ()
45
45
if self .rear >= 1 : # heap may need to be fixed
46
46
self .heapify_down ()
47
47
return min
You can’t perform that action at this time.
0 commit comments