Wrote HeapSort using written heap