Khan.randRange( 6, 11 ) heapsortStepPRO.initJSAV(arrSize)

Perform one iteration of heap sort. Swap the last key with the largest key and restore the heap in the array/tree shown below. Use the "Decrement" button to reduce the size of the heap.

[heapsortStepPRO.userInput]
if (!guess[0]) { return ""; // User did not click, and correct answer is not // initial array state } else { return heapsortStepPRO.checkAnswer(arrSize); }

Select the maximum element and move it to the correct location. Then restore the heap order.

Don't forget to decrement the heap size.