HW6 Assignment

What to do?

You must turn in your program by Wednesday, November 3rd, 2021 at 11:59am (NOON).
In the assignment, you are to implement a Symbol Table to allow variable assignment to the calculator. You are also to write the member methods for the UCSDStudent class as part of the Driver.java file used to test your symbol table.

Modifications to provided and existing code:

You are to provide the missing code to the member methods in the HashTable.java file, and the missing portions of the UCSDStudent class definition to the Driver.java file. The Hashing algorithm will be double hashing using a bully algorithm to decide between conflicts as discussed in class.

The methods to write in HashTable.java:

public static void debugOn ()
public static void debugOff ()

public HashTable (int sz, String caller)
public void jettison ()
public void getOccupancy ()
private boolean insert (Base element, boolean recursiveCall)
private Base locate (Base element)
public Base lookup (Base element)

Additional code to write in Driver.java:

Add appropriate class methods for UCSDStudent, which we have declared for you.

For all methods in this assignment, make sure to include code to display the corresponding catastrophic error and debug messages.

Method Descriptions

debugOn:

Turns on debugging for this HashTable.

debugOff:

Turns off debugging for this HashTable.

HashTable:

Allocates and initializes the memory associated with a hash table.

  • Values of sz are expected to be any positive prime. (You do not have to check if it is prime)
  • HashTable jettison:

    Called when jettisoning this HashTable. Jettisons each Base object stored in the HashTable, and the Tracker object.

    getOccupancy:

    Called to get the current occupancy of the Hash Table.

    insert:

    Inserts the element in the hash table. Returns true or false indicating success of insertion.

  • Values of element are expected to be complete elements to insert.
  • Values of recursiveCall represent whether or not this method was called recursively. The value is expected to be false when called from Driver's main.
  • locate: /* called from insert and lookup */

    Locates the index in the table where the insertion is to be performed, an item is found, or an item is determined not to be there. Sets the variable index to the last location checked; it will be used by insert and lookup. Returns the object if you find one, and null if the index is empty.

  • Values of element are expected to be complete and incomplete elements depending on whether it's called from insert or lookup.
  • lookup:

    Looks up the element in the hash table. Returns reference to the element if found, null otherwise.

  • Values of elements are expected to be incomplete elements (name is present but number is missing) to look up.
  • Grading breakdown

    Comments/Documentation:
    16%
    Style:
    25%
    Correctness/Execution:
    59%

    How to get started?

    Copy and past the following commands into your terminal

    cd
    cd ../public/hw6
    make install
    cd
    cd hw6/java
    mv Driver.java.empty Driver.java
    mv HashTable.java.empty HashTable.java
    ls