Question 14Asked in UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)

Consider the following binary search tree: Root: 24

Consider the following binary search tree: Root: 24 24 → left child 12, right child 26 12 → left child 11, right child 16 16 → left child 13 If we remove the root node, which of the node from the left subtree will be the new root?
  1. A11
  2. B12
  3. C13
  4. D16
Show answerHide answer

Correct answer: (D) 16

Explanation

If we delete the root node of a binary search tree, it can be replaced by its inorder successor or inorder predecessor. The inorder predecessor of 24 (largest node in the left subtree) is 16 and the inorder successor is 26. So, from the left subtree, 16 will be the new root.

From UGC NET Computer Science PYQ, June 2016 (Paper II & III, Selected Questions)

This is question 14 of UGC NET Computer Science PYQ, June 2016 (Paper II & III, Selected Questions). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.