Map keys to slots via a hash function. With a good hash, lookups average O(1). Collision handling (chaining, open addressing) and load factor determine performance.
Key formulas
Load factor: λ=n/m
Expected chain length (chaining): λ
Open addressing probe count (uniform hashing): ≈1−λ1 (successful), (1−λ)21 (unsuccessful)
Poisson distribution
Consider a hash table with m slots and n elements in it.
Denote the load factor by λ=(n/m). The probability that a given
slot has k elements is given by