41D. Summary

A hash function h(k) takes a key k and yields a positive integer. Typically, the integers are fairly large.

A hash table stores information in an array. If the array has physical size N, then the hash table stores key k at at index (h(k) mod N), the remainder when you divide h(k) by N.

Several different keys might need to be stored at the same index. One way to handle that, called chaining, is to store linked lists in the array.

It is important that the physical size of a hash table's array be roughly the same as the number of keys in the table. But it is enough for them to be within a small factor (such as 5) of one another.

Hash tables are not good in the worst case. If chaining is used, the worst case time to look up a key in a table containing n keys is Θ(n). But in the average case, hash tables are excellent: the time required to do a lookup, insertion or deletion is fixed, regardless of the number of keys in the table. (We say that the average case time is O(1).)