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 arraybased hash table for positive 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 of the hash table and a load factor threshold L The hash function will be The user input would be an integer denoting the size and a fraction denoting the load factor threshold For example, the user may enter initial size as the first input and load factor threshold as the second input. So you will place integers using 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 items, it should be resized to double of intial size and the existing elements should be rehashed with New elements will also be inserted using
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 to length
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
what are the differnece between hash table and hash function.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
