visual-cs

Hash Table — collision handling visualization

← All visualizations

Hash Table
Collision Explorer

Insert, search, and delete keys. Watch the hash function map them to buckets and see how Separate Chaining vs Open Addressing (linear probe) resolve collisions differently.

Load Factor
0.00
n/m — rehash threshold 0.75
Collisions
0
total collisions encountered
Capacity
11
prime table size m
Keys
0
currently stored
Quick Presets
Hash Table
Hash Function
Occupied
Inserted/active
Collision
Probing
Found
Deleted
Operation Log
No operations yet.
How it Works

Separate Chaining — each bucket holds a linked list. Colliding keys chain together; lookup traverses the chain.

Hash fn: djb2(k) % m
Average: O(1+α)
Worst: O(n) all in one bucket

Stats
0
Inserts
0
Searches
0
Deletes
0
Probes
Probe Trace
Last operation probe sequence.
Complexity

Average: O(1) insert / search / delete
Chaining worst: O(n) all in one bucket
OA worst: O(n) full-table probe
Space: O(n+m)