Last Updated : 21 Dec, 2018

Consider the following binary search tree:

\"\"
What binary search tree is obtained after the root of this tree is deleted?
(A)
\"\"
(B)
\"\"
(C) Both (A) and (B)
(D) None


Answer: (C)

Explanation: The correct algorithm replaces 7 with the successor (next-largest) node of 7, which is 10. The right subtree of 10 is moved to the location 10 was originally in
\"\"
Alternatively, you can replace 7 with its predecessor 6.(If 6 had a left subtree, it would be moved to where 6 was originally.)
\"\"

So, option (C) is correct.

Quiz of this Question


Share your thoughts in the comments