We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

I know you have probably forgotten about this problem, but I had the same question and found an answer, so hopefully this helps somebody else who comes along:

The tree in question is:

----3

-2-----6

1-4---5-7

in a BST, all nodes and subnodes on the left must be less than the current node, and all nodes and subnodes to the right must be greater than the current node. The reson its not a BST is that 4 is to the left of 3

## Trees: Is This a Binary Search Tree?

You are viewing a single comment's thread. Return to all comments →

My code is:

Input:Output:Can anyone please where is the problem?

I know you have probably forgotten about this problem, but I had the same question and found an answer, so hopefully this helps somebody else who comes along:

The tree in question is:

----3

-2-----6

1-4---5-7

in a BST, all nodes and subnodes on the left must be less than the current node, and all nodes and subnodes to the right must be greater than the current node. The reson its not a BST is that 4 is to the left of 3

Thx I was missing this!