Question: Construction of simple Hash table using arraysw In this assignment you will implement a simple array - based hash table for positiv 2 e integers

Construction of simple Hash table using arraysw
In this assignment you will implement a simple array-based hash table for positiv2e integers with modulo operator and place the integers into appropriate array cells. Collisions will be handled using linear probing. However, your hash table resizes itself if it reaches the threshold for the load factor, and reorganize the elements accordingly. The following are the specific requirements:
Programming requirements:
Your program prompts the user to specify the initial size N of the hash table and a load factor threshold L. The hash function will be %N. The user input would be an integer (denoting the size) and a fraction (denoting the load factor threshold). For example, the user may enter 7(initial size) as the first input and 0.8(load factor threshold) as the second input. So, you will place integers using %7 operations. The load factor threshold will never change throughout the program. However, the hash table will double its current size when the load factor is exceeded. Using the above example, when the table has 6 items, it should be resized to 14(double of intial size 7) and the existing elements should be re-hashed with %14. New elements will also be inserted using %14.
The program should have an interactive menu with the following options:
i) allow the user to insert an integer
ii) allow the user to delete an integer
iii) allow the user to find the current load factor of the hash table (should be displayed as a fraction).
iv) print (display) the entire hash table from index 0 to length -1
v) a 'Quit' option to terminate the program.
The menu should be repetitive until the user chooses the 'Quit' option. That is, the user should be prompted with the above menu after each action, until the user chooses option (v). A user may choose any option of the menu at any instance. Hence, appropriate check must be implemented if a user tries to delete, find load, or print an empty hash table. Also note, the resizing should be automatic based on the load factor threshold. User must not be asked to confirm resizing.
Safe assumption: user will work with all distinct positive integers. Hence, empty cells can be filled with -1.
what are the differnece between hash table and hash function.
Construction of simple Hash table using arraysw

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 Programming Questions!