heap in python

 
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)

版权声明:本文为博主原创文章,未经博主允许不得转载。

posted on 2013-11-25 19:31  江小鱼2015  阅读(181)  评论(0编辑  收藏  举报

导航