0Pricing
C Academy · Lesson

Collision Handling

Chaining and probing.

The Collision Problem

A collision happens when two distinct keys hash to the same bucket. Since collisions are unavoidable, every hash table needs a strategy to store multiple keys in one slot.

The two main families are chaining and open addressing.

Separate Chaining

With separate chaining, each bucket holds a linked list of entries. On collision you simply append (or prepend) to that bucket's list.

  • Buckets store list heads
  • Lookups walk one short list

All lessons in this course

  1. Hash Functions
  2. Collision Handling
  3. Insert, Lookup, Delete
  4. Resizing and Load Factor
← Back to C Academy