Why this approach is wrong?

sir, there is a function in the code with the name checkBST() i just want to know why is it not working ?

hello @we_kaash

the mistake is in this linne. root data must be bigger than all the elements in its left and must be smaller than all the data in its right.
but u are checking only for its left and right node.

ss

for such cases it will give wrong result

1 Like

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.