Hash Tables — Separate Chaining
Compute h(k) = k mod m to choose a bucket. If other keys have the same hash value, they are stored in the same bucket's linked list. A collision therefore adds another node to that chain; it does not require probing another table position.
This animation inserts new keys at the head of the linked list. Before inserting, it traverses the chain to avoid inserting a duplicate key. Search and deletion also follow the chain one node at a time; deletion unlinks the matching node.
With a good hash function and a controlled load factor, operations take expected O(1) time. More precisely, traversal takes expected O(1 + α), where α = n/m is the average number of keys per bucket. In the worst case, all keys may land in one bucket, giving O(n) operations.