← Quiz: Binary Search Tree Operations: all 15 questions
Quiz: Binary Search Tree Operations · Question 4 of 15
A node to be deleted has two children. Which key replaces it?
A node to be deleted has two children. Which key replaces it?
- A.Its left child's key
- B.The largest key in its right subtree
- C.The smallest key in its right subtree (the inorder successor)
- D.The root's key
Answer & explanation
Correct answer: The smallest key in its right subtree (the inorder successor)
The inorder successor is bigger than everything on the left and smaller than everything else on the right, so the BST rule still holds. (The inorder predecessor also works.)
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 →