public interface LocatorDictionary {
public int size();
public boolean isEmpty();
public Locator find(Object k); // Return locator for item (k',e) w/ k=k'
public Locator insert(Object k, Object o); // Insert (k,o), get back locator
public Object remove(Locator l); // Remove item at locator l
}
Your class should have a constructor that accepts a Comparator object and
builds an initially-empty hash table. Use the comparator object from last
assignment.
Use the rest of the classes from the solution to the previous
homework for implementing and testing solution to this homework.
To compute the integer key for the hash table, transform the 4 x 4 board
array to an integer as follows:
key <- 0
for i <- 0 to 3
for j <- 0 to 3
key += Board[i][j] * (i*4 + j)
i.e., unroll the 2-D array into a 1-D array and multiply the tile number
by its location and keep a running sum.