堆排序(内置模块 heapq )(NB)
# _*_coding:utf-8_*_
import heapq # q->queue 优先队列
import random
li = list(range(10))
random.shuffle(li)
print(li)
heapq.heapify(li) # 建堆(小根堆)
n = len(li)
for i in range(n):
print(heapq.heappop(li), end='')
if i < n - 1:
print(',', end='')