Question: Exercise 2 : Consider the following data : ( left { begin { array } { lllllllll } 1 7 5

Exercise 2: Consider the following data : \(\left\{\begin{array}{lllllllll}175 & 23 & 71 & 49 & 113 & 123 & 61 & 160 & 160\end{array}\right.\)\(157\}\). Insert these keys in a hash table of size \( M=19\) using close hashing with linear probing. Use the hash function \(\mathrm{h}(\mathrm{K})=\mathrm{K}\bmod 19\)
```
The data: [175,23,71,49,113,123,61,160,160,157]
The size of the hash table: 19
The hash table with linear probing for the given data: [-1.-1.-1.
-1.175.23.61.157.160.123.160.49.-1.-1.71.-1.-1.-1.
113.]
```
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:
1. Set alpha to 0.5(which means \(\mathrm{M}=2\mathrm{~N}\)). Use a random input and fill the hash table.
2. 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).
3. 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.
4. Write the number of comparisons in table form and their average in the space provided below.
Exercise 2 : Consider the following data : \ ( \

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!