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