Segmentation fault
i have addded the comments where the faults are, this would help
still not working did everything
Here you go, fixed and added comments for understanding
still not working showing wrong answer
hey, i just went through your entire code again, the mistake is not the in logic in the required function, but in the formation of tree, the answer shows and error because the preorder printing is wrong. On a wider note, the formation of the BST is wrong
here is the entire solution: https://ide.codingblocks.com/s/181411
but i will not recommend you to take a look at this, i am giving another link for reference look at that and compare your mistake first. In case, you are stuck for long, only then go for the complete solution
reference: https://ide.codingblocks.com/s/181412
mark this doubt as resolved, if you are satisfied with the solution.
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.