Hash Tables
Think of it like this
Imagine a library with a perfect librarian. You give them any book title; they instantly tell you exactly which shelf and slot it's in, without searching. They do this using a formula (the hash function) that converts the title to a shelf number.
"The Great Gatsby" → hash() → shelf 7, slot 3
"1984" → hash() → shelf 2, slot 0
"Dune" → hash() → shelf 9, slot 5That "librarian formula" is a hash function. The shelves are an array of buckets. This is a hash table.
How It Works
Step 1: You call map.set("name", "Alice")
Step 2: Hash function converts "name" to an integer
hash("name") → 104 (some deterministic integer)
Step 3: Map that to a bucket index
104 % 11 = 5 (11 = number of buckets)
