我正在尝试实现线性探测方法。现在,我来到这一点:
public class LinearProbing<Key, Value> {
private int size = 300001;
private Value[] value = (Value[]) new Object[size];
private Key[] key = (Key[]) new Object[size];
public Value put(Key thiskey, Value thisval) {
int hash = thiskey.hashCode();
for (int i = hash; key[i] != null; i = (i + 1) % size) {
if(key[i] == hash)
break;
key[i] = thiskey;
value[i] = thisval;
}
}
}
在此之后,我有点困惑。以下是我的疑惑:
如果我不清楚,请告诉我。