Skip to content

Commit 95ec539

Browse files
committed
Bug fixes, changed the queue DS to be used
1 parent 139d5d7 commit 95ec539

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
@@ -2,10 +2,10 @@
22
# Contributed: OMKAR PATHAK
33
# Created On: 11th August 2017
44

5-
from queue import Queue
5+
from pygorithm.data_structures import queue
66

77
# min-heap implementation as priority queue
8-
class Heap(Queue):
8+
class Heap(queue.Queue):
99
def parent_idx(self, idx):
1010
return idx // 2
1111

@@ -27,7 +27,7 @@ def heapify_up(self):
2727
Compare the rear item to its parent, swap if
2828
the parent is larger than the child (min-heap property).
2929
Repeat until the min-heap property is met.
30-
30+
3131
Best Case: O(1), item is inserted at correct position, no swaps needed
3232
Worst Case: O(logn), item needs to be swapped throughout all levels of tree
3333
'''

0 commit comments

Comments
 (0)