Helper function that allocates a new node with the given data and null left and right pointers .
static Node newNode ( int data ) { Node temp = new Node ( ) ; temp . val = data ; temp . left = temp . right = null ; return temp ; }