HeapSort for Program4, plus minor edits