Two distinct keys can hash to the same bucket — a collision. Hash tables stay O(1) on average by resolving collisions and resizing before buckets get crowded, controlled by the load factor.
Collision resolution
text
Separate chaining: each bucket holds a list
[3] -> ("cat",9) -> ("rat",2) # both hashed to 3
Open addressing: probe to the next free slot
hash=3 taken -> try 4 -> try 5 ... (linear probing)
