retagged by
243 views
0 votes
0 votes

The characters of the string K R P C S N Y T J M are inserted into a hash table of size of size 10 using hash function

h(x) = (ord(x) - ord(A) +1)

If linear probing is used to resolve collisions, then the following insertion causes collision

  • 1:Y

  • 2:C

  • 3:M

  • 4:P

The given ans is 3.. but what is the approach and what do we mean by ord?

retagged by

1 Answer

Best answer
0 votes
0 votes
Yes The answer is correct ! 'M' causes collision

Ord means -order of the Alphabet (in this case)

To fill the hash table:

There are 10 entries ....

0,1,2.....9

Formula is h(x)=(ord(x)-Ord(A)+1)%10

Ord(A)=65 Ascii value

Similarly calculate ord of all elements and fill the hash table .

U will notice that element M will collide with element C at position 3.
selected by

Related questions

2 votes
2 votes
1 answer
2
0 votes
0 votes
1 answer
3
Ray Tomlinson asked Aug 9, 2023
509 views
Numerical Answer Type Que?(please Try to give some ahortcut trick also or important concept is there to solve that question )