If node 16 is deleted from the following binary tree and the resulting binary tree is traversed in-order then what would be the sequence in which the nodes would be visited?
qImage68468548c8ab5bbbc48ab65a

This question was previously asked in
Beltron Programmer 1 Oct 2023 Official Paper
View all BELTRON Programmer Papers >
  1. 10, 19, 22, 44
  2. 22, 19, 10, 44
  3. 22, 10, 44, 19
  4. 19, 10, 44, 22

Answer (Detailed Solution Below)

Option 1 : 10, 19, 22, 44
Free
Beltron Programmer Mock Test
0.8 K Users
20 Questions 20 Marks 24 Mins

Detailed Solution

Download Solution PDF

The correct answer is : option 1

Key Points

In-order Traversal:

In-order traversal of a binary tree means: Left Subtree → Root → Right Subtree

Original Tree (Before deletion of node 16):

        22
       /  \
     10    44
       \
        16
          \
           19

In-order traversal before deletion: 10 → 16 → 19 → 22 → 44

Now delete node 16:
Since node 16 has only one child (19), deletion involves linking node 10 directly to node 19.

Modified Tree (After deletion of node 16):

        22
       /  \
     10    44
       \
        19

In-order traversal after deletion:

  • Left subtree of 22: Traverse 10 → 19
  • Visit root: 22
  • Right subtree of 22: 44

Sequence: 10, 19, 22, 44


Correct Option: Option 1) 10, 19, 22, 44

Additional Information

  • In-order traversal always visits the left subtree, then the root, then the right subtree.
  • When a node with only one child is deleted, its child is directly connected to its parent.
  • The resulting structure still maintains the binary search tree (BST) property.
Latest BELTRON Programmer Updates

Last updated on Nov 25, 2024

-> BELTRON Programmer 2024 Notification has been released on the official website.

-> The Bihar State Electronics Development Corporation Limited (BELTRON) has announced a recruitment drive for Programmer positions on a contractual basis.

-> Specific vacancy details will be shared separately.

-> Interested candidates can apply online from November 11, 2024, to December 10, 2024.

-> The Minimum age of the candidates should be 21 years and maximum age should be 59 year of age. 

More Searching Questions

Get Free Access Now
Hot Links: teen patti rummy 51 bonus teen patti gold teen patti gold download dhani teen patti