Question discussion

Consider a binary search tree given below. What is the pre-order traversal of binary search tree after node 14 is deleted?

360020Medium DSSSB TGT Computer Science 0 replies 0 views
0
Consider a binary search tree given below. What is the pre-order traversal of binary search tree after node 14 is deleted?

Figure for question 116

  • A7, 10, 11, 13, 16, 18, 20, 22, 25
  • B16, 10, 7, 13, 11, 20, 18, 25, 22
  • C16, 7, 10, 13, 11, 18, 22, 20, 25
  • D25, 20, 22, 18, 11, 13, 10, 16, 7
Correct answer: B

Explanation

When the root 14 (two children) is deleted, it is replaced by its in-order successor 16. The new tree has root 16, left subtree 10 (7, 13 (11)) and right subtree 20 (18, 25 (22)). Pre-order = 16, 10, 7, 13, 11, 20, 18, 25, 22.

Discussion 0

Nobody has replied yet. Start the discussion!