You are viewing a single comment's thread. Return to all comments →
Would not work in all cases.
Consider this tree: root.data = 2, root.left.data = 1, root.left.right.data = 3
1 is on the left of 2 and indeed smaller than 2. 3 is on the right of 1 and is indeed larger than 1. However, you can see that this is not a proper binary search tree since 3 is inside the left sub-tree of 2.