Sort array using heap sort. Build a max-heap, then repeatedly extract maximum element to end of array.
Examples