StudyGraph
Computer Science Explainer

Hash collisions: chaining vs open addressing

Two different keys, one slot. What does the hash table do?

Lesson notes

Key points

Definitions

Collision
When h(k1) mod m equals h(k2) mod m for two different keys k1 and k2.

Takeaway: Chaining uses lists; open addressing probes for another slot.

Quick check: Linear probing handles a collision by...
  1. Trying the next free slot
  2. Adding a linked list
  3. Deleting the old key

Linear probing is open addressing: it steps to i+1, i+2 until a free slot.

CollisionChainingOpen addressingLoad factor

Lessons like this, for your syllabus.

Short narrated study videos written for your course, level and exam. Free to start.

Get lessons for your own syllabus