+1 vote
in Data Structures & Algorithms I by (110k points)
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 elements

My doubt is from Binary Trees using Array topic in section Binary Trees of Data Structures & Algorithms I

I had been asked this question by my school principal while I was bunking the class.

1 Answer

+1 vote
by (672k points)
selected by
 
Best 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.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...