Question: Please download the HashingSample before start. Perform simulations to compare thepp observed performance of hashing with the following theoretical result: In linear probing, for a
Please download the HashingSample before start. Perform simulations to compare thepp
observed performance of hashing with the following theoretical result: In linear probing, for
a hashtable with final load factor lambda the expected number of probes in a successful search is
n
lambda
o
and in quadratic probing is
lambda
log
lambda
Declare a probing hash table whose size is a prime just greater than lambda where lambda is
the load factor, lying between and obtained as input from the user. Thus the test for
a final load factor of would declare a table of size approximately adjusted to be a
prime just greater than this value
Insert randomly generated integers into the table and count the average number
of probes used. This is the average cost of a successful search. Implement both linear and
quadratic probing prompt the user for the probe type Compare both linear and quadratic
probing with the theoretical results above.
Use hkey key mod n where n is the tablesize, as the hashing function.
Here is a sample execution of the program:
Enter load factor lambda between and :
Enter probe type for linear, for quadratic:
Actual average cost:
Expected cost from the equation:
Enter load factor lambda between and :
Enter probe type for linear, for quadratic:
Actual average cost:
Expected cost from the equation:
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
