Module M10 · 10 of 35 in teaching order · Intermediate

Hash Tables and Sets

Hashing, collisions and load factor: why lookups are expected O(1) and when they are not.

Lessons

  1. How hash tables get expected O(1) lookups: buckets, collisions, chaining, load factor and resizing, and what Dictionary, dict, HashMap and unordered_map do.

  2. Hash tables without chains: linear and quadratic probing, double hashing, clustering, tombstones, load factor limits, and how CPython's dict really probes.

Topics this module covers

The full module scope. Topics without a lesson above are not written yet.

  • hash functions
  • buckets
  • collisions
  • chaining
  • open addressing
  • linear/quadratic probing
  • double hashing
  • load factor
  • rehashing
  • maps/sets
  • equality
  • implementation
  • complexity

Builds toward