404 views

1 Answer

Best answer
3 votes
3 votes

For such problems where we have binary key and the table size is the kth power of 2 , the last 'k' bits will decide the hash value i.e. the location where the key will be mapped.

As table size  = 8 which is 23 , hence the trailing 3 bits will decide the table location of the key..

Hence , 

a) h(01010010)   =  010  =  2 ..

b) h(11011011)    =  011  =  3

c) h(10011010)   =   010  =  2[Collision]

                                    =  3[Collision]

                                    =  4

d) h(11111011)    =  011   = 3[Collision]

                                    = 4[Collision]

                                    = 5

e) h(01110010)   =  010   = 2[Collision]

                                    = 3[Collision]

                                    = 4[Collision]

                                    = 5[Collision]

                                    = 6

Hence total number of probes     =    1 + 1 + 3 + 3 + 5

                                                   =    13

selected by

Related questions

0 votes
0 votes
0 answers
1
rsansiya111 asked Mar 12, 2022
378 views
Canadian postal codes have the format LDL DLD, where L is always a letter (between A-Z), D is always a digit (0-9), and is always a single space. For example, the postal ...
0 votes
0 votes
1 answer
3
Ram Swaroop asked Jan 27, 2019
1,333 views
Consider the hashing table with 'm' slots and 'n' keys. If the expected number of probes in unsuccessful search is 3. The expected number of probes in a successful search...