Hash Table & Collision Resolution Simulator

Hash tables map keys to array slots in O(1) expected time via a hash function h(k), using open addressing or separate chaining to resolve collisions as load factor alpha grows.

Technical Reference & Equations

  • Table Load Factor: \alpha = \frac{n}{m} (n: stored keys, m: bucket slots; open addressing requires alpha < 1 (typically <= 0.7).)
  • Open Addressing Probe Sequences: h(k, i) = \big(h_1(k) + c_1 i + c_2 i^2\big) \bmod m, \quad h_{\text{dbl}}(k, i) = \big(h_1(k) + i \cdot h_2(k)\big) \bmod m (Linear uses c1=1, c2=0; double hashing eliminates primary and secondary clustering.)
  • Expected Unsuccessful Probes (Uniform Hashing): E[\text{probes}_{\text{open}}] \approx \frac{1}{1 - \alpha}, \quad E[\text{probes}_{\text{chain}}] = 1 + \alpha (Open addressing probe counts spike steeply as alpha approaches 1.)

View full Data Structures & Algorithms Formula Sheet | Constants Table

Related Data Structures Calculators