← Binary Trees & BST Quiz: all 8 questions
Binary Trees & BST Quiz · Question 6 of 8
Why is checking only left.val < node.val < right.val NOT enough to validate a BST?
Why is checking only left.val < node.val < right.val NOT enough to validate a BST?
- A.Every node must also respect limits set by all its ancestors, not just its parent
- B.Because BSTs can't have negative values
- C.Because it's too slow
- D.It is enough
Answer & explanation
Correct answer: Every node must also respect limits set by all its ancestors, not just its parent
A node deep in the left subtree must still be smaller than the root — pass down a (min, max) range.
Can you get the rest right without peeking?
Take the timed Binary Trees & BST Quiz quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →