Let us create trees in above example 1
Node root1 = new Node ( 1 ) ; root1 . left = new Node ( 2 ) ; root1 . right = new Node ( 3 ) ; root1 . left . left = new Node ( 4 ) ; root1 . right . left = new Node ( 6 ) ; root1 . right . right = new Node ( 7 ) ; Node root2 = new Node ( 0 ) ; root2 . left = new Node ( 1 ) ; root2 . right = new Node ( 5 ) ; root2 . left . right = new Node ( 4 ) ; root2 . right . left = new Node ( 6 ) ; root2 . right . right = new Node ( 7 ) ; if ( isSame ( root1 , root2 ) ) { Console . WriteLine ( " Same " ) ; } else { Console . WriteLine ( " Not ▁ Same " ) ; } } }