A key picks its own bucket.
transcript
Find one id among a million. Without reading the million. Let the key choose. A list would read half of them. A hash table reads about one.
Take five buckets, numbered zero to four. The hash is the remainder after dividing by five. Nineteen leaves four. It goes to bucket four. Each bucket holds a few keys at most.
To store a key, compute its bucket. Add the key to that bucket. Nothing else is touched. The hash decides where it lives.
To search, compute the same bucket. Look only in that bucket. Found, or proved absent. The same rule gives the same answer.
A list scan reads half the ids. A bucket holds about one. A million ids cost a few steps. The cost does not grow with n. That is the idea of a hash table.
The same key always gives the same bucket. Full breakdown in the lecture.