A hash table runs a key through a hash function to choose an array position. This direct address makes average lookups and inserts fast.
Distinct keys can collide at the same position. The demo chains items in a bucket; another design can probe for an empty slot.
When to use
Use it for dictionaries, caches, and indexes keyed by an identifier.