from heapq import heappop,heappush
a = [1,3,5,7,2,34,0,2]
heap = []
for i in a:
heappush(heap,i)
for x in range(len(a)):
print heappop(heap)
版权声明:本文为博主原创文章,未经博主允许不得转载。
from heapq import heappop,heappush
a = [1,3,5,7,2,34,0,2]
heap = []
for i in a:
heappush(heap,i)
for x in range(len(a)):
print heappop(heap)
版权声明:本文为博主原创文章,未经博主允许不得转载。
转载于:https://www.cnblogs.com/huaweiquankaiyueweiyuan/p/4964405.html