public void connect(TreeLinkNode root) {
         if (root == null)
        	 return;
        TreeLinkNode pre = root;
        TreeLinkNode currHead = root;
        root.next = null;
        while(currHead.left!= null ){
               currHead = pre. left;
                while(pre != null ){
                	
                     pre.left.next = pre.right;
                     if (pre.next == null)
                    	 pre.right.next = null;
                     else
                    	 pre.right.next = pre.next.left;
                     pre = pre.next;
                     
               }
               pre = currHead;
               
        }
        
      
}