in Algorithms edited by
322 views
0 votes
0 votes
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?
in Algorithms edited by
322 views

4 Comments

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

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

0
0

2 Answers

0 votes
0 votes
4

1 comment

how?
0
0
0 votes
0 votes
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 .