Not getting all elements of binary tree

We need to create a tree from preOrder and inOrder Traversal arrays…
I am not getting the desired output.
the link of my code :

Corrected Code

@sanjit_15 You had written root->left, root->left in the recursive call instead of root->right

1 Like

Thank you for the help… :smile:

Hey, i don’t know why your code is giving incorrect answer.Your code appear perfectly fine to me.Just see their implemtationa and try to find error,i couldn’t find any error in your code