Question: C++ help: I need help to create a hash function and hash table using the requirements below. a) Create an array of 4-digits student IDs

C++ help: I need help to create a hash function and hash table using the requirements below.

a) Create an array of 4-digits student IDs of Size 500 using the random generator function. Display the array.

b) Using the division method for a hash function H and a hash table of size m, a prime number, store your data of 4-digits student IDs (n = 500) to a hash table where each cell is chained to a link list.

Note: H (k) = k mod m.

m = the size of the hash table. A prime number larger than and not too larger than 500 / 3 and 2**5 < m < 2**6 ( ** means power of 2).

c) Print out the hash table with contents of each cell (addresses) which are head pointers pointing to a chain of linked list of IDs. Do 20 searches 17 with ID found and the other three with ID not found.

d) Use a counter during the searches to compute the line of statements where each searching goes through. (This would represent the computation time).

e) Display ID to be searched and the result for each search with the computation time by counting the number of times the search function has gone through.

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