Day 4: Dictionaries Are Magic (Until They Aren’t) — Hashing & Collisions
You think dictionary lookup is always O(1). That’s only half the story. Today, you understand how dictionaries actually work. Today’s Goal By the end of today, you will: Understand how dictionaries store data Learn how hashing works Understand collisions and their impact Know when O(1) breaks down The Illusion user = { "name": "John", "age": 30 } You think: This is just key-value storage Reality: This is a highly optimized hash table Dictionary Internal Model key -> hash(key) -> index -> slot -> value Dictionary does NOT scan all keys. It jumps directly using hash. ...