Question: In Java, implement open address (aka linear probing) hash table into this interface public interface HashTable { public void add(String key, V value); public V
In Java, implement open address (aka linear probing) hash table into this interface
public interface HashTable {
public void add(String key, V value);
public V remove(String key);
public V lookup(String key);
public Object[] getValuesList();
public V[] getSortedList(V[] list);
}
with these given hash functions
public int additiveHash(char[] key, int TABLE_SIZE) { int hash = 0; for (char c: key) { hash += c; } return hash % TABLE_SIZE; } public int rotationalHash(char[] key, int TABLE_SIZE) { int hash = 0; for (char c: key) { hash += (c << 7) ^ (c >> (TABLE_SIZE - 7)) ^ hash; } hash = Math.abs(hash); return hash % TABLE_SIZE; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
