Question
IN JAVA This class implements a dictionary using a hash table with separate chaining. You will decide on the size of the table, keeping in
IN JAVA
This class implements a dictionary using a hash table with separate chaining. You will decide on the size of the table, keeping in mind that the size of the table must be a prime number. A table of size between 5000-10000, should work wel
For this class, you must implement all the public methods in the following interface:
public interface DictionaryADT { public int put(Configuration pair) throws DictionaryException;
public int put(Configuration data) throws DictionaryException: Inserts the given Configuration object referenced by data in the dictionary. This method must throw a DictionaryException (see below) if the configuration string stored in data, is already in the dictionary. You are required to implement the dictionary using a hash table with separate chaining
public void remove(String config) throws DictionaryException: Removes the entry with configuration string config from the dictionary. Must throw a DictionaryException (see below) if the configuration is not in the dictionary.
public int getScore(String config): A method which returns the score stored in the dictionary for the given configuration string, or -1 if the configuration string is not in the dictionary.
Since your HashDictionary class must implement all the methods of the DictionaryADT interface, the declaration of your method should be as follows: public class HashDictionary implements DictionaryADT You can download the file DictionaryADT.java from the courses website. The only other public method that you can implement in the HashDictionary class is the constructor method, which must be declared as follows public HashDictionary(int size) this initializes a dictionary with an empty hash table of the specified size. You can implement any other methods that you want to in this class, but they must be declared as private methods (i.e. not accessible to other classes).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started