public void connect(TreeLinkNode root) {       
        while(root != null){
        	TreeLinkNode nextStart = null;
            TreeLinkNode prev = null;
            
            for( ; root != null; root = root.next){
            	if(nextStart == null) nextStart = 
            			(root.left != null) ? root.left : root.right;
            	
            	if(root.left != null){
            		if(prev != null) prev.next = root.left;
            		prev = root.left;
            	}
            	
            	if(root.right != null){
            		if(prev != null) prev.next = root.right;
            		prev = root.right;
            	}
            }
            root = nextStart;
        }
    }