Get list of elements currently in heap using heapq in Python?
Get list of elements currently in heap using heapq in Python? Question: This structure i have built for easier understanding and usability class PriorityQueue: """ Implements a priority queue data structure. """ def __init__(self): self.heap = [] self.count = 0 def push(self, item, priority): entry = (priority, self.count, item) heapq.heappush(self.heap, entry) self.count += 1 def …