DSA

Concepts

Array: a row of numbered lockers

Every locker has a number (its index) starting from 0. If you know the number, you walk straight to it. If you only know what is inside, you open lockers one by one.

Hash map: a cloakroom with shelves

A hash function turns a name into a shelf number. To store or find something, you compute the shelf and go there. That is why lookups are fast.