Skip to content
Azhimathi Mayam logoDSA Study HubPCCST303 · KTU · S3
B.Tech S3 (R) (FT/WP) Examination November 2025 (2024 Scheme)QP 06PCCST303112503Part B · Q16a6 marksCO4Module 4asked in 2 papers

Question 16a

Given the values 72,13,6,5,10,36,43 and 17 and a hash table of size 11. Show the resultant table after inserting values in the given order by using hash function h(k)=k%11 with each of the following collision strategies. i) Linear Probing ii) Quadratic Probing iii) Separate Chaining

Topics: Collision resolution: linear probing, quadratic probing, double hashing, Open hashing (separate chaining)

Watch this exact question run

Loading visualizer…

Other parts: Quadratic probingSeparate chaining

Solution

Assumptions:
  • Quadratic probing uses (h(k) + i²) mod 11, i = 0, 1, 2, …
  • Separate chaining appends new keys at the end of the chain.
Key72136510364317
k mod 116265103106
i) Linear probing — probe trace (generated)checked by code
KeyHome h(k)ProbesStored at
726(6 + 0) mod 11 = 66
132(2 + 0) mod 11 = 22
66(6 + 0) mod 11 = 6 → (6 + 1) mod 11 = 77
55(5 + 0) mod 11 = 55
1010(10 + 0) mod 11 = 1010
363(3 + 0) mod 11 = 33
4310(10 + 0) mod 11 = 10 → (10 + 1) mod 11 = 00
176(6 + 0) mod 11 = 6 → (6 + 1) mod 11 = 7 → (6 + 2) mod 11 = 88

Final table — 0: 43 | 1: — | 2: 13 | 3: 36 | 4: — | 5: 5 | 6: 72 | 7: 6 | 8: 17 | 9: — | 10: 10

ii) Quadratic probing — probe trace (generated)checked by code
KeyHome h(k)ProbesStored at
726(6 + 0²) mod 11 = 66
132(2 + 0²) mod 11 = 22
66(6 + 0²) mod 11 = 6 → (6 + 1²) mod 11 = 77
55(5 + 0²) mod 11 = 55
1010(10 + 0²) mod 11 = 1010
363(3 + 0²) mod 11 = 33
4310(10 + 0²) mod 11 = 10 → (10 + 1²) mod 11 = 00
176(6 + 0²) mod 11 = 6 → (6 + 1²) mod 11 = 7 → (6 + 2²) mod 11 = 10 → (6 + 3²) mod 11 = 44

Final table — 0: 43 | 1: — | 2: 13 | 3: 36 | 4: 17 | 5: 5 | 6: 72 | 7: 6 | 8: — | 9: — | 10: 10

iii) Separate chaining (generated)checked by code
KeyHome h(k)ChainStored at
726append6
132append2
66append6
55append5
1010append10
363append3
4310append10
176append6

Final table — 0: — | 1: — | 2: 13 | 3: 36 | 4: — | 5: 5 | 6: 72 → 6 → 17 | 7: — | 8: — | 9: — | 10: 10 → 43

How to write it in the exam

IndexLinearQuadraticChaining
04343—
1———
2131313
3363636
4—17—
5555
6727272 → 6 → 17
766—
817——
9———
10101010 → 43

Key collisions: 6 (at 6 → 7), 43 (at 10 → wraps to 0), 17 (linear: 6, 7 → 8; quadratic: 6, 7, 10 → (6+9) mod 11 = 4).

How this answer was verified
  • Hand computation
  • tests/hashing-search.test.ts (exact tables)
  • hashing_open_addressing.c and hashing_chaining.c differential tests

Similar questions