1.

Is the below tree representation of 50,100,400,300,280 correct way to represent cartesian tree?(a) true(b) falseQuery is from Cartesian Tree topic in section Binary Trees of Data Structures & Algorithms IThis question was posed to me in class test.

Answer»

The correct choice is (a) true

The BEST I can explain: A tree with heap property (parent is EITHER small or big than CHILDREN) and when traversed in inorder yields the given input SEQUENCE is called as a cartesian tree. as the above figure satisies both the properties. note that even MIN heap tree can be generated. the above is a max heap tree.



Discussion

No Comment Found

Related InterviewSolutions