public void connect(TreeLinkNode root) {
    	if (root == null)
    		return;
    	
    	Queue<TreeLinkNode> que = new LinkedList<TreeLinkNode>();
    	que.offer(root);
    	que.offer(null);
    	
    	while (que.isEmpty() == false)
    	{
    		TreeLinkNode node = que.poll();
    		if (node == null && que.isEmpty() == false)
    			que.offer(null);
    		else if (node != null)
    		{
    			TreeLinkNode next = que.peek();
    			node.next = next;
    			if (node.left != null)
    				que.offer(node.left);
    			if (node.right != null)
    				que.offer(node.right);
    		}
    	}
    }