Consider a binary search tree given below. Root 14 has left child 10 and right child 16. 10 has left child 7 and right child 13; 13 has left child 11. 16…
Consider a binary search tree given below.
Root 14 has left child 10 and right child 16. 10 has left child 7 and right child 13; 13 has left child 11. 16 has right child 20; 20 has left child 18 and right child 25; 25 has left child 22.
What is the pre-order traversal of the binary search tree after 14 is deleted?
Show answerHide answer
Correct answer: (B) 16, 10, 7, 13, 11, 20, 18, 25, 22
Explanation
14 has two children, so it is replaced by its in-order successor 16, the smallest key in its right subtree. 16's right child 20 moves up. Pre-order is then 16, 10, 7, 13, 11, 20, 18, 25, 22.