Can a tree stored in an array using either one of inorder or post order or pre order traversals be again reformed?

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
 
Answer: B
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.
 

Tìm kiếm

Back
Top