Let us create binary tree given in the above example
Node * root = newNode ( 10 ) ; root -> left = newNode ( 2 ) ; root -> right = newNode ( 6 ) ; root -> right -> right = newNode ( 5 ) ; root -> left -> left = newNode ( 8 ) ; root -> left -> right = newNode ( 4 ) ; test ( root , 10 ) ; test ( root , 2 ) ; test ( root , 6 ) ; test ( root , 5 ) ; test ( root , 8 ) ; test ( root , 4 ) ; return 0 ; }