Test cases are not passing

@tharun let me check your code.

@tharun hey there is problem in your print node in range function,I have corrected it ,please check and also make the output in desired form mentioned in question.


Hope you get it.

i have used preorder for traversing, you used inorder for printing what’s the difference ,but both are getting same output

@tharun hey ,I am not using inorder only ,In yor logic you are going to each node and calling on its left and right ,but it is bst so we can use its property ,in this question n1 < n2 ,so at each node you can take decision whetherto go left or right ,you dont have to call recursion to both sides so if n1data so search in left otherwise right.Hope you get it.

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.