Prateek bhaiya told that we can get the hint from InOrder Traversal…
The Inorder Traversal would be
1 3 5 6 7 8
How do I approach for the solution…!?
Help Required
Prateek bhaiya told that we can get the hint from InOrder Traversal…
The Inorder Traversal would be
1 3 5 6 7 8
How do I approach for the solution…!?
Help Required
@sanjit_15, first solve the question of constructing binary tree from preorder and Inorder
(prerequisite), then proceed to this question , the thing is for any binary tree we can construct a unique binary tree if we are given inorder of the tree and any one of {preorder or postorder} traversal of tree, so in this question we are only given preorder, now the trick is the given tree is a bst which means the inorder traversal of the tree is sorted , so you can easily get the inorder by sorting the preorder , then u can simply use the algo of Constructing tree from preorder and inorder and get your answer
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.