322 views
A hash table of size 10 using open addressing with linear probing and hash function is h(k)= (k)mod10 , where k is key value , initially table is empty . Following keys are inserted into table in given order .

44,87,43,68,30,20,67

How many number of probes required to insert 17 in table after inserting above keys?

How would you be so sure without probing that the location after element 20 is empty ?
Ok got it , thanks 👍

@Kabir5454 My bad. I found ‘total number of probes to insert 17 starting from inserting the first element”. It would be 6.

4

### 1 comment

how?
The answer would be 6 probes becoz linear probing has a formula we can say and that is hf(key,i) = hf(key) + i mod M(hash table size) where i € 0 to M-1 . Count the i which for 17 . There will be 5 collisions and 6 comparisons.  17 key will be inserted at index 2 .
by