Sunday , 24 November 2024

CS301 Assignments # 5 Solution Spring 2012

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 **********************\

 


Spring 2012_CS301_5_SOL

Check Also

CS301 unSolved Final Term papers Mega Colletionction by Arslan Ali

      FINALTERM  EXAMINATION Spring 2010 CS301- Data Structures Time: 90 min Marks: 58 …

Leave a Reply

Your email address will not be published. Required fields are marked *

*