Mental Model
A hash table stores data by turning keys into numbers to find values quickly. It uses a special math rule called a hash function to do this.
Analogy: Imagine a library where each book has a unique code made by a machine. Instead of searching all shelves, you use the code to go directly to the right shelf and spot.
Hash Table: [0] -> null [1] -> null [2] -> null [3] -> null [4] -> null Hash Function: key -> index Example: key 'cat' -> hash function -> index 2