# Hash Table Visualizer

Insert, look up and delete keys and watch the machinery: a hash function turns each key into a bucket index, collisions chain up in the same bucket, the load factor climbs, and once it crosses 0.75 the table doubles and rehashes everything. Separate chaining, live.

β˜… Star on GitHub
Ready. Put a key to see it hashed into a bucket.
entries (size) 0
buckets (capacity) 8
collisions 0
longest chain 0
load factor 0.00
resize + rehash triggers at 0.75
the hash function (djb2)
h = 5381 for each char c: h = h * 33 + c.code bucket = h % capacity
Try this: hit +5 random a few times and watch entries land in buckets by their hash. Two keys hitting the same bucket is a collision β€” they chain together (that's why lookups scan a short list, not a single slot). Keep adding and watch the load factor bar climb toward 0.75; when it crosses, the table doubles its buckets and rehashes every key into the bigger table β€” which is why average insert/lookup stays O(1) even though any single insert might trigger an O(n) resize. Change a value for an existing key with put and it updates in place instead of adding a duplicate.