Question: After heapsort heapifies, it then begins removing things from the top of the heap and placing them at the end of the array. How will your answer from the above question look after four iterations?
Hint: Here is the code given in class for heapsort. This question asks you to perform the fist four iterations of the loop on the answer from the previous question.
void heapsort(int* A, int len) { // Make a heap from A heapify(A, len); // Sort it for(int i = len - 1; i > 0; i--) { int temp = A[i]; // swap A[i] = A[0]; A[0] = temp; siftUp(A, i, 0); // make heap of size i } }