Using division method [h(k) = k mod m], at which position 177 and 197 key…

2021

Using division method [h(k) = k mod m], at which position 177 and 197 key values are stored in hash table when the size of hash table is 57?

  1. A.

    6,26

  2. B.

    7,27

  3. C.

    26,6

  4. D.

    27,7

Attempted by 374 students.

Show answer & explanation

Correct answer: A

To find the positions of keys 177 and 197 in a hash table of size 57 using the division method h(k) = k mod m, compute the hash value for each key.

For key 177:

h(177) = 177 mod 57

57 × 3 = 171, and 177 - 171 = 6.

So, h(177) = 6.

For key 197:

h(197) = 197 mod 57

57 × 3 = 171, and 197 - 171 = 26.

So, h(197) = 26.

Therefore, the keys 177 and 197 are stored at positions 6 and 26, respectively.

Explore the full course: Up Lt Grade Assistant Teacher 2025