Hash Table

A hash table stores key-value pairs using a hash function to map keys to storage locations.
Also known as
hash map

Intuition

Instead of searching every item, a hash table jumps close to where a key should be stored.

Technical definition

Hash tables use hash functions, buckets, and collision handling to support average-case constant-time lookup, insertion, and deletion.

Example

A dictionary object in many languages is implemented using a hash-table-like structure.

Common misunderstandings

  • Hash tables can degrade with poor hashing or adversarial keys.
  • They do not preserve sorted order by default.

Need this inside a product?

The studio builds the systems these terms describe. Tell us what you are working on.