All mock tests are FREE till 31 December — register to save your progress
Unit 7 · Data Structures and Algorithms Paper 2 CS · November 2021

A hash function h(key) = key mod 7 with linear probing is used to insert the keys 44, 45, 79, 55, 91, 18, 63 into a table indexed 0 to 6. What will be the location of key 18?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: C. 5

Explanation

44 → 2, 45 → 3, 79 → 2 → 4, 55 → 6, 91 → 0, 18 → 4 (taken) → 5. Key 18 lands in slot 5.

More Data Structures and Algorithms questions