You are viewing a single comment's thread. Return to all comments →
Check your examples again, they're not BST. The first example says node 3 is a child of node 1, yet node 2 is a child of node 2?
Second example works because it's a BST. Third example says node 4 and 5 are children of node 1, node 2 is its own child, node 3 is its own child.