Finished exercise 18 with heap sort implementation