Given a Binary Tree and an array arr[] consisting of values of nodes to be deleted, the task is to print Inorder Traversal of the forests after deleting the nodes.

Examples:

Input:_ arr[] = {10, 5} _

        10
       /  \
      20   30
     / \    \
    4   5    7

Output:

_4 20 _

30 7

_Input: __arr[] = {5} _

         1
       /   \
      5     6
     /       \
    10       12 

Output:

_10 _

1 6 12

Approach: Follow the below steps to solve the problem:

  1. Perform the Postorder Traversal of the Binary Tree.
  2. For each node, check if it contains the value to be deleted.
  3. If found to be true, store its child as the root of the forest. Print the forest by Inorder Traversal.

#big data

Print the Forests of a Binary Tree after removal of given Nodes
1.30 GEEK