Question: In this project, we will need to implement a Java class for hash tables which are equipped with the search, insertion, and deletion methods with

In this project, we will need to implement a Java class for hash tables which are equipped with the search,
insertion, and deletion methods with respect to the following techniques for resolving collisions:
Separate chaining. The index for a key x is obtained by the hashing function:
h(x)=x@ TABLESIZE
(10 points) Search: To check if a specific key x exists within the hash table, locate its list using
h(x) and traverse it. If such an element with key x is found, the search is successful; otherwise, it
indicates that the key does not exist within the table.
(15 points) Insertion: To insert an element in a hash table, the algorithm locates the list with the
corresponding hash index h(x). If the element isn't already in this list, it is added to the beginning.
This approach allows multiple keys with the same hash index to be stored without issues.
(15 points) Deletion: To remove a key from a hash table, first find the list at the hash index h(x).
If the list has the key, remove it. If not, do nothing.
Linear probing. The index for a key x is obtained by the hashing function
hi(x)=(x: TABLESIZE +i)TABLESIZE
(10 points) Search: To determine if key x exists, iteratively probe from the initial hash index h(x)
until an empty slot or the starting index is encountered. If found, return the index of x; if not, the
search fails.
(15 points) Insertion: This method follows the search method but inserts x into the first unoccupied
slot. If it cycles back to the initial hash without finding an open slot, insertion fails.
(15 points) Deletion: Proceed with the search to locate x. Upon finding x, remove it just by
marking this slot out of the hash table and return.
The content of each element is a positive integer key-value pair. You may use the type int to represent
the key-value pair.
(10 points) You are also required to provide a method to display the content of the hash table. Your
display should show not only the keys but also the associated values.
(5 points) Implementing the following test case using the separate chaining technique.
Creating an empty hash table of size 11.
Consecutively insert the following keys into the hash table and display the table content after each
insertion.
54,19,23,34,125,37,45,42
Deleting the key 125 and displaying the table content.
Searching the key 45 and displaying the table content.
Inserting the key 68 and displaying the table content.
4.(5 points) Implementing the above test case using the linear probing hashing technique
In this project, we will need to implement a Java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!