Build the Heap from the following input array A = [12, 9, 6, 25, 3, 2, 15, 13, 21, 27, 7, 26].ATTENTION: Fill the table below as your final answer. Do NOT just leave your results in the heap.
The array A after the BuildHeap step: index 1 2 3 4 5 6 7 8 9 10 11 12 value?
BuildHeap(A)
{
heap_size(A) = length(A);
for (i = length[A]/2, i>= 1, i–)
Heapify(A, i);
}
Heapify(A, i){
l = Left(i); r = Right(i);
if (l <= heap_size(A) && A[l] > A[i])
largest = l;
else
largest = i;
if (r <= heap_size(A) && A[r] > A[largest])
largest = r;
if (largest != i)
Swap(A, i, largest);
Heapify(A, largest);
}