41. What makes a good hash function, and how are collisions resolved?
MediumSymbol tables & hashing
Technical
Show model answer
A good hash function is fast, deterministic and spreads keys uniformly across buckets. Collisions are resolved by separate chaining (a list per bucket) or open addressing: linear probing (simple, but clusters), quadratic probing, or double hashing.
Keep the load factor bounded (for example below 0.75) by resizing and rehashing, which keeps operations O(1) on average.