1 |
|
Consider the max heap above. After the end of the first iteration of the loop that takes place in executing Heap Sort , the array for of the max heap will take the form of :
1 |
|
Where , , and are positive integers. Input as the answer.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
First we swap first and last elements. A={0,2,1,6}. Then execute heapify procedure for first 3 elements. And get {2,0,1,6} ```Pascal Heapify(A, i)
left ← 2i
right ← 2i+1
largest ← i
if left ≤ A.heap_size и A[left] > A[largest]
if right ≤ A.heap_size и A[right] > A[largest]
if largest ≠ i then swap A[i] ↔ A[largest] Heapify(A, largest) ```