public void add(Integer k, Integer v) {
        int nHeight = 1;
        Node<Integer, Integer> x = root, y = null;
        while (x != null) {
            int cmp = k.compareTo(x.key);
            if (cmp == 0) {
                x.value = v;
                return;
            } else {
                y = x;
                if (cmp < 0) {
                    x = x.left;
                } else {
                    x = x.right;
                }
                nHeight++;
            }
        }
        Node<Integer, Integer> newNode = new Node<Integer, Integer>(k, v);
        if (y == null) {
            root = newNode;
        } else {
            if (k.compareTo(y.key) < 0) {
                y.left = newNode;
            } else {
                y.right = newNode;
            }
        }
        size++;
        if (nHeight > height) {
            height = nHeight;
        }
    }