826 views
0 votes
0 votes

The number of comparisons required to search 48 in hash table with chaining is pos = x % 10. The elements inserted into hashtable is
0, 32, 42, 200, 150, 22, 48, 120, 18, 108, 12, 110, 38, 24

  1.   1
  2.   2
  3.   3
  4.   4

2 Answers

Best answer
2 votes
2 votes

The new element is always inserted to the beginning of the list in chaining.

So, by the time all the insertions are done, the elements at position 8 should be:- 38 -> 108 -> 18 -> 48

So 4 comparisons

selected by
2 votes
2 votes

The picture shows the Hash Table after insertion of all the elements :

                                              

Now 48 % 10 = 8, It directly goes to slot 8 and compares with the first element in the list which is the required element.

So, number of comparisons is 1.

Related questions

0 votes
0 votes
3 answers
2
pankaj_vir asked Oct 10, 2018
1,212 views
What is the total number of comparisons needed in the best case to find minimum and maximum of $300 $ elements?
2 votes
2 votes
2 answers
3
iarnav asked Mar 30, 2018
1,095 views
The minimum number of comparisons required to find the minimum and the maximum of 101 numbers is ________.When n is even then it's relatively easy, but how to deal with n...
1 votes
1 votes
1 answer
4