heap finished and tested with heapsort