Stuff
public cpp v1 · immutable public void insert(String key) { if (!contains(key)) { int i; int loc = h(key); for (i = 0; i < N && table[loc].isOccupied(); i++) { loc = (loc+1)%N; } if (i < N) { table[loc] = new Entry('o',key); } } } public boolean contains(String key) { int loc = h(key); int i; for (i = 0; i < N && !table[loc].isEmpty(); i++) { if (table[loc].isOccupied()) { nComparisons++; if (table[loc].equals(key)) { return true; } } loc = (loc+1)%N; } return false; }