Finished heap and heapsort