Node structure
static class node { int val ; node left ; node right ; node ( ) { this . val = 0 ; this . left = null ; this . right = null ; } node ( int x ) { this . val = x ; this . left = null ; this . right = null ; } node ( int x , node left , node right ) { this . val = x ; this . left = left ; this . right = right ; } } ;