Create tree using postorder and inorder


I am not getting correct answer. What am i doing wrong here?

hi @akshitabansal321 refer https://www.youtube.com/watch?v=LgLRTaEMRVc, try witout map in interiew also u will be asked to do like this so better refer once

map is used here to get the index of root from inorder array, so instead of map we can use linear search, right?

i have watched this video, i am using his approach but with some changes, please check my code and tell me my mistakes.

hi @akshitabansal321 can u send me the updated code with linear search one

https://ide.codingblocks.com/s/682893 I have updated it

hi… please check the code

hi @akshitabansal321 updated and commented

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.