Design a class called DirectHashed (the class java file should be called DirectHashed.java) that encodes an expanded version of a direct hashed data structure, with the following exact1 fields/data members/attributes and methods/operations in this order:
Field/Method | Description |
Data | A field for the primary storage area array that stores in each element a reference to a single node (initialized with null) |
DirectHashed | A constructor with no parameters that creates the Data array and initializes all elements with null |
SubtractionPreprocessing | A method that determine the index of the target key into the primary storage area array (without generating negative indexes) |
DirectHashing | A method that maps a target key into the unique index in the primary storage area array |
Insert | A method that inserts a new contact (given as parameter) into the structure |
Fetch | A method that fetches a contact (name given as parameter) from the structure |
Delete | A method that deletes a contact (name given as parameter) from the structure |
Update | A method that updates a contact (name given as parameter) from the structure with a new contact (given by the second parameter) |
Output | A method that outputs all the values from the structure |
Design a class called LQHashed (the class java file should be called LQHashed.java) that implements an LQHashed data structure, with the following exact fields/data members/attributes and methods/operations in this order:
Method | Description |
N | A field for the size of the primary storage array |
Data | A field for the primary storage area array of contacts |
DefaultQuotient | A field for the default 4k+3 prime (9967) |
LoadingFactor | A field for the loading factor (default 0.75) |
Size | A field for the number of nodes in the structure |
LQHashed | A constructor that initializes the fields and use the parameter as the length for the 4k+3 algorithm |
Insert | A method that inserts a new contact (given as parameter) into the structure |
Fetch | A method that fetches a contact (name given as parameter) from the structure |
Delete | A method that deletes a contact (name given as parameter) from the structure |
Update | A method that updates a contact (name given as parameter) from the structure with a new contact (given by the second parameter) |
Output | A method that outputs all the values from the structure |
Finally, once you have designed the 2 classes (DirectHashed and LQHashed), design a program/project/driver class.