public void delete(Key key) {
        int i = hash((String)key);
        if (st[i].contains(key)) {
            N--;
        }
        st[i].delete(key);

        // halve table size if average length of list <= 2
        if (M > INIT_CAPACITY && N <= 2 * M) {
            resize(M / 2);
        }
    }