Write a program that implements the provided BasicSymbolTable API interface using a
hash table that resolves collisions using separate chaining. Skeleton implementations of the
hash table (ChainingSymbolTable), linked list (EntryList), and key (ProductID) are provided
where you need to add your code.
You must properly implement the API. This includes not allowing null keys, null values
values, and no duplicates. You have to keep track of the size of each linked list. The
ChainingSymbolTable will also have to maintain the size of the overall hash table. Note: you
cannot derive the hash table’s size from the linked list, the size() method must remain O(1)
You should shrink/rehash when the load factor falls below the minimum threshold of 2
but should not allow M to go below the initial value of 4. You should expand/rehash when the
load factor goes above the maximum threshold of 8. You should use the constants provided.
You will also have to implement the hashCode and equals methods for the provided
ProductID object to serve as the key for the symbol table. The implementations should use
the approaches outlined in lecture. You do not need to modify the Product class.
Use array of EntryList. Need to use cast as follows:
this.items = (EntryList
Size is synonymous with N, items.length is synonymous with M.
Increment size if necessary. Rehash if necessary.
Decrement size if necessary. Rehash if necessary.
Can be accomplished in several ways. To get similar results to example output, use
approach in lecture taking the hashCode from the key, make it positive by &’ing with
0x7fffffff, and then taking modulo the length of the table (i.e. items).
Use the provided Queue implementation which implements Iterable.
Can be accomplished in several ways. Can try creating new ChainingSymbolTable,
add all key/value from old table, then set items to new table’s items.
The internal Entry class must be a singly linked list with reference only to front.
EntryList.put(Key key, Value value):
Must overwrite value if entry for key already exists.
Push the new, non-duplicate entry onto the front of the list.
Keep reference to prior entry so can easily remove. Handle special cases.
Use the template provided for you
Have a style (indentation, good variable names, etc.)
Comment your code well (no need to over do it, just do it well)
You may not:
• Make your program part of a package.
• Use code from anywhere except your own brain.
• Name a folder with your gmu username
• Put your java files in the folder (but not your .class)
• Zip the folder (not just the files) and name the zip “username-pa9.zip”
• Submit to blackboard
• Non-submitted assignments
• Late assignments
• Non-compiling assignments
• Non-independent work
1pt Submission Format
1pt Style and Comments
1pt EntryList put
2pts EntryList delete
1pt EntryList keys
1pt ProductID hashCode, equals
1pt ChainingSymbolTable put
1pt ChainingSymbolTable delete
0.5pt ChainingSymbolTable rehash
0.5pt ChainingSymbolTable keys
> java ChainingSymbolTable operations.txt
Final symbol table=
 size=4:(GMU,54), (GMU,70), (GMU,62), (GMU,78)
 size=4:(GMU,55), (GMU,71), (GMU,63), (GMU,79)
 size=4:(GMU,56), (GMU,72), (GMU,64), (GMU,80)
 size=3:(GMU,57), (GMU,73), (GMU,65)
 size=3:(GMU,58), (GMU,74), (GMU,66)
 size=4:(GMU,59), (GMU,75), (GMU,51), (GMU,67)
 size=4:(GMU,60), (GMU,76), (GMU,52), (GMU,68)
 size=4:(GMU,61), (GMU,77), (GMU,53), (GMU,69)