It is $4$ .
In linear probing if a bucket is free the next bucket is filled . I didnt get how they have implemented the hash function .
Consider the below table $h(x) = mod 10$
0 |
80 |
1 |
71 |
2 |
62 |
3 |
|
4 |
44 |
5 |
|
6 |
26 |
7 |
87 |
8 |
108 |
9 |
|
Here when you have to compare for ( say 90 )
You wil have to check buckets in location 0, 1, 2,3 .
3rd bucket is empty so search failed . => 4 Comparisions
Like wise check for the worst case . Maximum we will have only 4 comparisions for any key