plz let me know the algo for disp of this problem
Create tree ( Using preorder and inorder)
Hello @akb.tech17
Let us consider the below traversals:
Inorder sequence: D B E A F C
Preorder sequence: A B D E C F
In a Preorder sequence, leftmost element is the root of the tree. So we know ‘A’ is root for given sequences. By searching ‘A’ in Inorder sequence, we can find out all elements on left side of ‘A’ are in left subtree and elements on right are in right subtree. So we know that A is the root and D B E are to the left of A and F C are to the right of A from In order traversal
Recursively call createTree for the left and the right tree