Implemented HeapSort for array