import heapq
heapq.heapify(listName)
Push element into heap
heapq.heappush(listName,element)
Remove and get smallest element
smallest=heapq.heappop(listName)
heapq.heapify(listName)
Push element into heap
heapq.heappush(listName,element)
Remove and get smallest element
smallest=heapq.heappop(listName)
Comments
Post a Comment