Question: write code JAVA Exercise 3 : The load factor is defined as alpha = N / M , where N is the size of the

write code JAVA Exercise 3:
The load factor is defined as alpha = N/M, where N is the size of the input (the number of keys), and M is the output size (the hash_table). If alpha is small, i.e., the hash table is large, there will be fewer chances of collision.
Modify your code in Exercise 1 to do the following:
Set alpha to 0.5(which means M =2N). Use a random input and fill the hash table.
Generate a random key and search it in the hash table. Count the number of comparisons
you had to make (regardless the search was successful or not).
Do step 2(the search operation) several times (at least 10 times) for a different key in the
same hash table. Every time note down the number of comparisons.
Write the number of comparisons in table form and their average in the space provided
below.
Iteration # 1
23
# of comparisons xxx
xxx xxx

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!