1,119 views
0 votes
0 votes
Given the preorder/postorder and inorder traversal of a binary tree, we can always construct a unique binary tree (I think so, correct me if I am wrong)

Construct a binary tree with the nodes A, B, C such that its preorder traversal is ABC and its inorder traversal is CAB.

1 Answer

2 votes
2 votes
unique tree can be generated

(preorder and inorder)=    yes

(postorder and inorder)=  yes

( preorder and postorder )=  no

 (inorder= cab and preorder=abc) => such tree dosnt exist.

Related questions

2 votes
2 votes
2 answers
1
Vegeta asked Jul 16, 2018
1,337 views
How to Construct Full Binary Tree from given preorder and postorder?Thank you.
1 votes
1 votes
1 answer
2
pradeepchaudhary asked Aug 19, 2018
19,105 views
8. What are the worst case and average case complexities of a binary search tree?a) O(n), O(n)b) O(logn), O(logn)c) O(logn), O(n)d) O(n), O(logn)