Helper function to allocate a new node with the given data and left and right pointers as None
static TreeNode newNode ( int x ) { TreeNode temp = new TreeNode ( ) ; temp . val = x ; temp . left = null ; temp . right = null ; return temp ; }