Problem Statement
Which module implements a min-heap based priority queue?
Explanation
heapq maintains the smallest element at index zero and supports push, pop, and nlargest or nsmallest helpers.
It is lightweight and works on plain Python lists, making it ideal for scheduling, streaming top-k, and Dijkstra style tasks.
Code Solution
SolutionRead Only
import heapq h=[] heapq.heappush(h,3); heapq.heappush(h,1) print(heapq.heappop(h)) # 1
