Heapsorting lists