Pick the fix
Which tree passes a parent-and-child-only check but is not a valid search tree?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Root 5, left child 3, and 3 has a right child 7
Right: 7 > 3 locally, but 7 sits left of 5, which breaks the rule.
A local check never compares 7 with 5; passing the limit 5 down to the left subtree catches it.
Why not the others?
- B Root 5, left 3, right 8. This one is valid.
- C Root 5 with only a right child 4. 4 < 5 on the right fails even the local check.