Consider the given binary search tree, if the root node will be deleted, the…

2022

Consider the given binary search tree, if the root node will be deleted, the new root can be –

image.pngimage.png
  1. A.

    43 or 48

  2. B.

    63 or 81

  3. C.

    48 or 59

  4. D.

    30 or 63

Attempted by 354 students.

Show answer & explanation

Correct answer: C

Concept

To delete a node that has two children in a Binary Search Tree, you replace it with one of two values: its inorder predecessor (the LARGEST key in its left subtree, found by going left once then as far RIGHT as possible) or its inorder successor (the SMALLEST key in its right subtree, found by going right once then as far LEFT as possible). Both choices keep the inorder ordering intact, so either may legitimately become the new root.

Application

  1. The node being deleted is the root, 50. Its left subtree is rooted at 30 and its right subtree is rooted at 63.

  2. Inorder predecessor = largest key in the left subtree. Walk down the right edge of the left subtree: 30 then 43 then 48. There is no node larger than 48 on the left, so the predecessor is 48 (NOT the root 30 — 30 is just where the left subtree starts).

  3. Inorder successor = smallest key in the right subtree. Walk down the left edge of the right subtree: 63 then 59, and 59 has no left child. So the successor is 59 (NOT the root 63).

  4. Replacing 50 with either of these two keys preserves the BST, so the new root can be 48 or 59.

Cross-check

Read the whole tree in inorder: 10, 15, 25, 30, 36, 43, 48, 50, 59, 63, 73, 77, 81. The keys immediately on either side of 50 are exactly 48 and 59 — these are the predecessor and successor, confirming the new root must be one of 48 or 59.

Explore the full course: Up Lt Grade Assistant Teacher 2025