Skip to content

Commit 3709b28

Browse files
committed
Made Py 3.6 compatible
1 parent 2d8a3b4 commit 3709b28

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pygorithm/data_structures/heap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# min-heap implementation as priority queue
88
class Heap(Queue):
99
def parent_idx(self, idx):
10-
return idx / 2
10+
return idx // 2
1111

1212
def left_child_idx(self, idx):
1313
return (idx * 2) + 1
@@ -16,7 +16,7 @@ def right_child_idx(self, idx):
1616
return (idx * 2) + 2
1717

1818
def insert(self, data):
19-
super(Heap, self).enqueue(data)
19+
super().enqueue(data)
2020
if self.rear >= 1: # heap may need to be fixed
2121
self.heapify_up()
2222

@@ -41,7 +41,7 @@ def heapify_up(self):
4141

4242
def pop(self):
4343
''' Removes the lowest value element (highest priority, at root) from the heap '''
44-
min = self.dequeue()
44+
min = super().dequeue()
4545
if self.rear >= 1: # heap may need to be fixed
4646
self.heapify_down()
4747
return min

0 commit comments

Comments
 (0)