Collision identification:
• All three keys (24, 54, 84) produce the same hash index: 24 MOD 10 = 4, 54 MOD 10 = 4, 84 MOD 10 = 4 (1 mark)
• This means all three keys collide at index 4 (1 mark)
• Collisions must be resolved- only 1 value can be stored at each index (1 mark)
Linear probing:
• With linear probing, 24 is placed at index 4, 54 is placed at index 5, and 84 at index 6 (1 mark)
• This causes clustering, where consecutive slots are filled, degrading performance for future insertions and lookups (1 mark)
• Searching for key 84 would require checking index 4, then 5, then 6 - meaning O(n) lookup instead of O(1) (1 mark)
Chaining:
• With chaining, all three keys are stored in a linked list at index 4 (1 mark)
• This avoids clustering but searching within the chain is O(n) for the number of items in the chain (1 mark)
Evaluation:
• Both methods degrade from O(1) to O(n) performance due to collisions (1 mark)
• The hash function is poor for this data set because all keys share the same last digit (1 mark)
Max 6 marks