Should I make an array of inorder of BST and search the 2 elements or is there any other method?
What is the right approach?
Hey @goyalvivek yes your approach is correct store the inorder traversal in an arr and then sort the arr the resulant arr will be the recovered tree. The time complexity is O(nlogn) and space complexity will be O(n).
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.
please provide me with the solution of this question
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.