Question: Given an array A = < 7 , 6 , 5 , 4 , 3 , 2 , 1 > , apply the bottom -
Given an array A apply the bottomup heap construction algorithm buildMinHeapA to transform it into a minheap. Please show the updated array after each swap made during the downHeap procedure.
Follow the pseudocode provided from M slides:
buildMinHeapA n
for i n down to
downHeapA i
downHeapA i
smallest index of the smallest element among
Ai and its two children
if smallest i
swap Ai with Asmallest
downHeapA smallest
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
