pop element from heap : Heapq : Buildin Module PYTHON TUTORIALS


PYTHON TUTORIALS » Buildin Module » Heapq »

 

pop element from heap


from heapq import *
from random import shuffle
data = range(10)
shuffle(data)
heap = []
for n in data:
   heappush(heap, n)
   
print heappop(heap)
print heappop(heap)
print heappop(heap)
print heap



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Buildin Module
» Heapq