2,108 views
0 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 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.
Position:
Show:

Related questions

0 0 votes
2 2 answers
585
585 views
admin asked Jul 21, 2022
585 views
The preorder traversal of a binary search tree is given by $12, 8, 6, 2, 7, 9, 10, 16, 15, 19, 17, 20$.Then postorder traversal will be:$2, 6, 7, 8, 9, 10, 12, 15, 16, 17...
14 14 votes
3 3 answers
8.0k
8.0k views
sunil sarode asked Nov 10, 2017
8,036 views
A Full Binary Tree is a binary tree where every node has either 0 or 2 children.what i knowwith Preorder and Inorder , Inorder and Postorder and Inorder and Level-order ...
2 2 votes
2 2 answers
2.0k
2.0k views
Vegeta asked Jul 16, 2018
1,952 views
How to Construct Full Binary Tree from given preorder and postorder?Thank you.
1 1 vote
1 1 answer
19.6k
19.6k views
pradeepchaudhary asked Aug 19, 2018
19,627 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)