Binary tree from inorder and postorder

can u help me understand what is wrong in my code. Please point out the error in this code only.

ide->https://ide.codingblocks.com/s/254108

ques->https://www.interviewbit.com/problems/binary-tree-from-inorder-and-postorder/

hello @mikkyimran
image
u r given postorder not preorder.
so u should construct right subtree first and then left subtree .
interchange those two lines.

ur updated code->

Postorder is left right root , so why right should be constructed first @aman212yadav
is it because i am building from the root of postorder?

yeah right . . . …

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.