Question 75Asked in DSSSB TGT Computer Science (Technical), 1 Aug 2021, Shift 3

Which statement(s) is/are correct regarding node N deletion in binary search tree?

Which statement(s) is/are correct regarding node N deletion in binary search tree? I. If node N has no children then just replace location of N in the parent node by the null pointer. II. If node N has two children, then replace it by preorder successor.
  1. AOnly I
  2. BOnly II
  3. CBoth I and II
  4. DNeither I nor II
Show answerHide answer

Correct answer: (A) Only I

Explanation

A leaf node is removed by setting its parent's pointer to null (I correct). A node with two children is replaced by its inorder successor (or predecessor), not its preorder successor, so II is wrong.

From DSSSB TGT Computer Science PYQ (Technical), 1 Aug 2021, Shift 3

This is question 75 of DSSSB TGT Computer Science PYQ (Technical), 1 Aug 2021, Shift 3. 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.