Hide text Hide pseudo-code | |

The HeapSort algorithm has been executed until line 2. In the figure, you can see the input array (both as an array and a binary tree representations). Continue the execution from line 2. | |

HeapSort(array heap) 1. BuildHeap(heap) 2. while heap.getSize() > 1 do 3. heap.swap(0, heap.getSize()-1); 4. heap.setSize(heap.getSize()-1); 5. MaxHeapify(heap, 0) |