public void connect(TreeLinkNode root) {

        if (root == null || root.getLeft() == null || root.getRight() == null) {
            return;
        }

        if (root.getLeft() != null) {
            root.getLeft().setNext(root.getRight());
        }

        if (root.getRight() != null && root.getNext() != null) {
            root.getRight().setNext(root.getNext().getLeft());
        }

        connect(root.getLeft());
        connect(root.getRight());

    }