@Override
    public void add(E elem) {
        if (root == null) {
            root = new Node(elem, null, null, null);
        } else {
            for (Node start = root; start != null; ) {
                if (start.item.compareTo(elem) > 0) {
                    if (start.left != null) {
                        start = start.left;
                    } else {
                        start.left = new Node(elem, start, null, null);
                        break;
                    }
                } else if (start.item.compareTo(elem) < 0) {
                    if (start.right != null) {
                        start = start.right;
                    } else {
                        start.right = new Node(elem, start, null, null);
                    }
                } else {
                    break;
                }

            }
        }
    }