Essential cookies keep your basket and sign-in working. Optional cookies help us understand visits and measure ads. Privacy details.
Data structure that implements an associative array with O(1) average lookup time.
AI-assisted explanation. It may contain errors; use a textbook or original source to check important details.
A hash table is a clever “instant index” for data. Imagine you have a huge pile of labeled items—like names mapped to phone numbers—and you want to find one item fast without scanning everything. A hash table does this by using a hash function, which is like a machine that takes a key (e.g., "Alice") and deterministically turns it into a bucket number (an array index). The table stores the value (e.g., a phone number) in that bucket. When you want to look up "Alice" later, you run the same key through the same hash function, jump straight to the bucket, and retrieve the value. The magic phrase “O(1) average lookup time” means: as the table grows, the expected time to find an item stays roughly constant—like checking a numbered mailbox rather than searching a whole city. It’s “average” because sometimes two different keys land in the same bucket (a collision). Hash tables handle collisions using strategies like chaining (each bucket holds a small list) or open addressing (probe for another open spot). With a good hash function and a reasonable load factor (not too full), lookups feel nearly instantaneous.
Hash tables were born from a very practical mid-20th-century problem: computers were starting to manage large collections of records (think payrolls, inventory, library catalogs) stored on relatively slow memory and disk. Searching linearly through records was expensive. Researchers in the 1950s developed “hashing” as a way to compute an address directly from a key—turning the problem of search into the problem of arithmetic. Early hashing work appeared in the 1950s (notably at IBM and in broader research literature) as a method for “scatter storage” or “random access” files. The central breakthrough was the realization that you could trade a small amount of extra space and occasional collision-handling work for dramatically faster average retrieval times. Over time, hashing became a foundational idea in programming languages (dictionaries/maps), databases (hash indexes, hash joins), and systems software.
Pioneered by: There isn’t a single unique discoverer, but early widely cited pioneers include: - Hans Peter Luhn (IBM), who described hashing-like ideas in the early 1950s for information retrieval. - Arnold I. Dumey, who wrote early influential work on “hashing”/scatter storage methods in the 1950s. Hash tables as used today are the result of multiple contributions across the 1950s–1960s, including collision-resolution schemes and analyses of expected performance.