Skip to content

Commit

Permalink
Update priority_queue.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yeonicy authored Mar 27, 2024
1 parent 52b1955 commit 99a1ef1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions priority_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ def push(self, item, priority):
def pop(self):
if len(self.heap) > 1:
self._swap(0, len(self.heap) - 1)
priority, item = self.heap.pop()
_, item = self.heap.pop()
self._sift_down(0)
return item
elif len(self.heap) == 1:
priority, item = self.heap.pop()
_, item = self.heap.pop()
return item
else:
return None
Expand Down

0 comments on commit 99a1ef1

Please sign in to comment.