Suppose we have a hash table with 10 buckets and the symbols S1 to S7 are intially entered using a hashing function using linear probing. What can be the maximum number of comparisions needed in searching an item that is not present? The hashing diagram can be explained as:
Index KEY
0 - - S7
1 - - S1
2 - - Empty
3 - - S4
4 - - S2
5 - - Empty
6 - - S5
7 - - Empty
8 - - S6
9 - - S3
Suppose I want to find an element S8(which is obviously not present) ..On Calculating the hash function for S8 suppose it jumps to index 8. Not finding the element at index 8, by linear probing it checks the next index and so on .. Now, the number of comparisons should come out to be total length of the array because by linear probing it should try to look in every index...but the actual answer is 5! :| Please anyone explain!!