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 ) ; Console . WriteLine ( " Before ▁ Replacing ▁ Nodes " ) ; printInorder ( root ) ; replaceNode ( root , 0 ) ; Console . WriteLine ( ) ; Console . WriteLine ( " After ▁ Replacing ▁ Nodes " ) ; printInorder ( root ) ; } }