← Quiz: Binary Search Tree Operations: all 15 questions
Quiz: Binary Search Tree Operations · Question 5 of 15
Why does the inorder successor of a node with two children never have a left child?
Why does the inorder successor of a node with two children never have a left child?
- A.It is found by going left as far as possible, so a left child would be even smaller and would have been chosen
- B.Because successors are always leaves
- C.Because the right subtree has no left children
- D.It can have a left child; that case needs special code
Answer & explanation
Correct answer: It is found by going left as far as possible, so a left child would be even smaller and would have been chosen
That is why deleting the successor afterwards is always the easy case: a leaf or one right child.
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 →