File size: 162 Bytes
1514a0b
 
 
 
 
 
 
1
2
3
4
5
6
7
import heapq as hq

def heap_sort(iterable):
    h = []
    for value in iterable:
        hq.heappush(h, value)
    return [hq.heappop(h) for i in range(len(h))]