Question. 1 (10 Marks)
Consider the following MAX HEAP, represent this heap in the form of an array, start the array index from 1 instead of 0.
Question 2. (10 Marks)
Consider the following array, the value on each index of this array represents the node value of a complete binary tree, you are required to create the complete binary tree from this array.
Hints:
If “i” is an index of a node then “2i”, “2i +1” and “i/2” represent the left child, right child and parent of the this node respectively.
/****************** Assignment No. 5 : Solution **********************\
Question No. 1
The array representation of the given MAX HEAP is as follows,
Question No. 2
The complete Binary tree for the given array would be as follows,
/****************** DOWNLOAD SOLUTION FROM HERE **********************\