Answer it
Hash table with linear probing for lockers
5 marksYou mark it yourself against the marking points
A gym stores members in a hash table with 7 slots, numbered 0 to 6. A member's slot is their card number mod 7 (the remainder after dividing by 7). If that slot is taken, the next slot is tried (6 wraps round to 0) until a free one is found. The table starts empty.
(a) Calculate the slot each card number goes into when these are inserted in this order. Show your working. [3]
15, 22, 9, 29
(b) Define the term collision, as used for hash tables. [1]
(c) A member asks for card 29. State how many slots are examined when searching for card 29, including the slot where it is found. [1]
[5]