Docsity

Array Representation, Binary Trees-Data Structure-Assignment Solution, Exercises of Data Structures and Algorithms

Toggle sidebar
bg1
Course๎˜ƒCode:๎˜ƒ๎˜ƒCS301๎˜ƒ(Data๎˜ƒStructures)๎˜ƒ
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,๎˜ƒ
๎˜ƒ
As๎˜ƒthe๎˜ƒgiven๎˜ƒtree๎˜ƒis๎˜ƒnot๎˜ƒonly๎˜ƒa๎˜ƒcomplete๎˜ƒbinary๎˜ƒtree๎˜ƒbut๎˜ƒalso๎˜ƒobey๎˜ƒthe๎˜ƒheap๎˜ƒproperty,๎˜ƒso๎˜ƒit๎˜ƒis๎˜ƒalso๎˜ƒ
a๎˜ƒMIN๎˜ƒHEAP.๎˜ƒ
๎˜ƒ
docsity.com

Partial preview of the text

Download Array Representation, Binary Trees-Data Structure-Assignment Solution and more Exercises Data Structures and Algorithms in PDF only on Docsity!

Course Code: CS301 (Data Structures)

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, As the given tree is not only a complete binary tree but also obey the heap property, so it is also a MIN HEAP.

docsity.com