CMSC 420 Section 0401 - Programming Assignment 1, Part B
Due March 8, 11:45PM

Part B - Visualization with gnuplot

In part B, you will extend the work you did in part A.

  1. You need to update your implementation of HashTable.java.
  2. You also need to provide a driver class HashTablePlotData.java, which will generate gnuplot data.
    See description as follows:
Recall that in part A, you wrote HashTable.java. In part B, the class extends AbstractHashTable as shown below:
public class HashTable extends AbstractHashTable {
	// Methods with the same functions as in Part A
	public HashTable (int tableSize);
	private HashTable ();
	public int getSize ();

	// In Part B, hashValue(String key) and probleHashValue(String key)
	// are inherited from AbstractHashTable.
	public int hashValue (String key);
	public int probeHashValue (String key);

	public int probeCount; // doesn't need to declare, inherited from AbstractHashTable.
	public boolean put (String key, Object value);
	public boolean containsKey (String key);
	public boolean remove (String key);

	// Methods new in Part B
	public Object get (String key);
	public int longestProbe ();
    }
If you note carefully, you will find that in Part B, two new methods are defined: Next the driver. The driver class HashTablePlotData will output a gnuplot file which in turn will generate a PostScript file like success.ps, unsuccess.ps, and longest.ps. (Take a look at these files now! More on this gnuplot business follows, but basically most of the spade-work has already been done. You can concentrate on the programming.) The goal is to produce charts of average cost(probes) of successful and unsuccessful search with collisions handled by double hashing. How do we produce these files? Use HashTable.probeCount wisely to implement HashTablePlotData. That basically finishes your programming task. Here is some post processing. Visualization is accomplished with gnuplot. You can figure out how this works by the examples provided below.

Grading:

Submission:

Web Accessibility