Constructing tree given in the above figure
root = newNode ( 3 ) ; root -> left = newNode ( 2 ) ; root -> right = newNode ( 5 ) ; root -> left -> left = newNode ( 1 ) ; root -> left -> right = newNode ( 4 ) ; cout << " Before ▁ Replacing ▁ Nodes STRNEWLINE " ; printInorder ( root ) ; replaceNode ( root ) ; cout << endl ; cout << " After ▁ Replacing ▁ Nodes STRNEWLINE " ; printInorder ( root ) ; return 0 ; }