Question discussion

The keys 50, 30, 70, 20, 40, 60, 80, 35, 45 are inserted in that order into an empty BST. The node 30 is then deleted by replacing it with…

1337Medium DSSSB TGT Computer Science 0 replies 1 views
0

The keys 50, 30, 70, 20, 40, 60, 80, 35, 45 are inserted in that order into an empty BST. The node 30 is then deleted by replacing it with its inorder successor. The preorder traversal of the resulting tree is

  • A50 35 20 40 45 70 60 80
  • B50 20 40 35 45 70 60 80
  • C50 35 40 45 70 60 80
  • D50 40 35 45 70 60 80
Correct answer: A

Explanation

The inorder successor of 30 is 35 (leftmost node of its right subtree); 35 replaces 30, giving preorder 50, 35, 20, 40, 45, 70, 60, 80.

Discussion 0

Nobody has replied yet. Start the discussion!