int sum = 0;
char[] letters = string.reverse();
for(int i = 0; i < letters.length; i++)
sum += letters[i] + (i * 100);
public class NaiveHashTable {
private String[] table = new String[1000]; // all = null
private int indexOf(String x) { return Math.abs(x.hashCode() % 1000); }
public boolean contains(String x) {
int hash = indexOf(x);
return table[hash] != null && table[hash].equals(x);
}
public void add(String x) {
int hash = indexOf(x);
if ( table[hash] == null )
table[hash] = x;
else if ( table[hash].equals(x) )
; // do nothing
else
?
}
}
final Object dummyNull = new Object();
c = 0.5 * (1 + 1/(1-L))
c = 1 + (L / 2)
@SuppressWarnings("unchecked")
LinkedList<String>[] table = new LinkedList[100];
for(int i = 0; i < table.length; ++i)
table[i] = new LinkedList<>();