Today i am doing a problem on Binary Trees during which I found a structure of BSTree which is satisfying property : “Every node has smaller value on its left child and greater value on its right child”. But it is not a BST ( in my opinion ) because root has smaller value than one of its grand child.Please Explain me all this .
Binary tree :
7
/ \
4 10
/ \
2 8
Tell me is this BST or Not ? Explain .
A more correct definition of a BST can be found here:
So, although your tree satisfies the specific case of every node having a smaller value to its left and a larger value to its right, it does not satisfy the more general case involving the left and right subtrees, and is therefore not a BST.