Lesson Plan

Lesson Plan
Grade: Date: 17/01/2026
Subject: Computer Science
Lesson Topic: Show understanding of hashing algorithms
Learning Objective/s:
  • Describe the purpose and principle of hashing and hash functions.
  • Explain at least two collision‑resolution methods (open addressing and separate chaining) and their trade‑offs.
  • Apply a simple hash function to compute bucket indices and evaluate the load factor.
  • Analyse how load factor and uniform distribution affect hash‑table performance.
  • Design a small hash table using separate chaining for a given set of keys.
Materials Needed:
  • Projector or interactive whiteboard
  • Slide deck with hash‑function examples
  • Handout worksheet for hash‑table practice
  • Laptops with an IDE or Python interpreter
  • Printed diagram of a hash table with chaining
  • Whiteboard markers
Introduction:

Begin with a quick poll: who has ever used a password manager or looked up a file by name? Recall that arrays give direct access only when we know the exact index. Today we’ll explore how hashing turns keys into indices, enabling near‑instant retrieval, and we’ll learn how to judge if a hash design works.

Lesson Structure:
  1. Do‑now (5') – students answer a short question comparing array indexing with key‑based lookup.
  2. Mini‑lecture (10') – introduce hash functions, the division method, and work through a student‑number example.
  3. Demonstration (8') – live coding in Python to compute h(k)=k mod m and show a collision.
  4. Guided practice (12') – pairs complete a worksheet, hashing a list of keys and drawing a chaining diagram.
  5. Concept check (8') – click‑questions comparing open addressing vs. separate chaining and discussing load factor.
  6. Exam question practice (12') – students solve the provided sample exam problem, then share answers.
Conclusion:

Summarise that a good hash function spreads keys uniformly and that keeping the load factor below 0.75 maintains O(1) operations. For the exit ticket, each student writes one advantage and one drawback of the method they used on a sticky note. Homework: complete the online quiz on hashing and read the next chapter on tree‑based file organisation.