← Quiz: Binary Search Tree Operations: all 15 questions
Quiz: Binary Search Tree Operations · Question 6 of 15
Root 10 has left child 5, and 5 has right child 12. Is this a valid BST?
Root 10 has left child 5, and 5 has right child 12. Is this a valid BST?
- A.Yes, because 12 > 5
- B.No, because 12 is in the left subtree of 10 but is larger than 10
- C.Yes, because 10 < 15 on the right
- D.It depends on the height
Answer & explanation
Correct answer: No, because 12 is in the left subtree of 10 but is larger than 10
Checking only parent–child pairs would wrongly say yes. With ranges, 5's right subtree must stay in (5, 10).
Can you get the rest right without peeking?
Take the timed Quiz: Binary Search Tree Operations quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →