Daily iOS
CS fundamentals and algorithms

Hash maps and Dictionary

If you had to implement a hash map yourself, how would you build it?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

Hash the key into a bucket index, handle collisions with chaining or open addressing, and resize once the load factor is exceeded. Swift's Dictionary uses open addressing (linear probing) and seeded SipHash.

Share a question