Activity 01
Pair Programming: Implement Hash Table
Students in pairs write a hash table class with insert, search, and delete methods using modular hashing and chaining. They test with 50 keys, logging collisions. Pairs swap code to debug and compare load factors.
How does a hash function contribute to the efficiency of data lookup?
Facilitation TipDuring Pair Programming: Implement Hash Table, remind students to print intermediate states of their table so they can trace collisions visually as they code.
What to look forPresent students with a small hash table (e.g., size 10) and a list of keys to insert. Ask them to trace the insertion process, showing the hash function calculation, the resulting index, and how collisions are handled using separate chaining. Then, ask them to calculate the load factor.