1.

Can a tree stored in an array using either one of inorder or post order or pre order traversals be again reformed?(a) Yes just traverse through the array and form the tree(b) No we need one more traversal to form a tree(c) No in case of sparse trees(d) Yes by using both inorder and array elementsMy doubt is from Binary Trees using Array topic in section Binary Trees of Data Structures & Algorithms II had been asked this question by my school principal while I was bunking the class.

Answer»

Correct choice is (b) No we need one more traversal to form a tree

For EXPLANATION: We need any two traversals for tree formation but if some additional STUFF or TECHNIQUES are used while storing a tree in an array then one traversal can FACILITATE like also storing null VALUES of a node in array.



Discussion

No Comment Found

Related InterviewSolutions