Amazon interview question

Implementation of heapsort