Changes to Hash table

TechWritereditor · 5 Dec 2026, 05:27 · “New page”

+ added − removed (first version)

Title

Removed:  
Added: Hash table

Short description

Removed:  
Added: Data structure that finds items by key very quickly

Type

Removed:  
Added: technology

Summary

Removed:  
Added: A hash table is a data structure that stores items by key and uses a hash function to work out where each item lives in an array. This lets programs look up items very quickly, usually in roughly constant time.

Fact box

Removed:  
Added: Type: Data structure
Added: Also called: Hash map
Added: Key idea: Hash function maps keys to array positions
Added: Collision handling: Chaining, open addressing
Added: Typical lookup time: Constant on average
Added: Early idea: Hans Peter Luhn, IBM, 1953

Article

Added: **Hash table** is the name for a data structure that stores items, such as names with their phone numbers, so that each can be found quickly by its key. Formally, it is a dictionary in which keys are mapped to positions in an array by a hash function.[^1]
 
Added: ## How it works
Added: A hash table is built on an ordinary array. A hash function turns each key into an array index by doing arithmetic on it. A good hash function is quick to calculate and spreads keys evenly across the array.[^2] When the keys of two or more items map to the same position, this is called a collision.[^1] There are many ways of handling collisions, but they fall broadly into chaining and open addressing.[^1]
Added:  
Added: In separate chaining, each array position holds a linked list of all the items whose keys hash to it, and a search scans only that short list. In linear probing, a form of open addressing, an item whose position is taken goes into the next free slot. The share of the table that is filled, called the load factor, affects speed; with linear probing it must stay below one, and searches slow down as the table fills.[^2]
Added:  
Added: Because a lookup goes straight to one position rather than checking every item, a hash table can retrieve a key in constant time, written O(1), when stored keys have different hash values.[^3]
Added:  
Added: ## History
Added: The idea goes back to [[IBM]] researcher Hans Peter Luhn. In early 1953 he wrote an internal memo suggesting that information be sorted into "buckets" to speed up searching. His method combined the digits of a value such as a telephone number to produce a bucket label, so a search only had to scan the entries in one bucket rather than the whole list.[^4]
Added:  
Added: ## Uses
Added: Hash tables are built into many programming languages. In [[Python (programming language)]], the dictionary type is implemented as a resizable hash table, chosen because it usually gives faster lookups than B-trees and is simpler to implement.[^3]
Added:  
Added: ## See also
Added: - [[Secure Hash Algorithms]]
Added: - [[Python (programming language)]]
Added: - [[Donald Knuth]]

Sources

Removed:  
Added: hash table | https://xlinux.nist.gov/dads/HTML/hashtab.html | National Institute of Standards and Technology (Dictionary of Algorithms and Data Structures) | 2022-04-20
Added: Hash Tables (Algorithms, 4th Edition, Section 3.4) | https://algs4.cs.princeton.edu/34hash/ | Princeton University
Added: Design and History FAQ: How are dictionaries implemented in CPython? | https://docs.python.org/3/faq/design.html | Python Software Foundation
Added: Hans Peter Luhn and the Birth of the Hashing Algorithm | https://spectrum.ieee.org/hans-peter-luhn-and-the-birth-of-the-hashing-algorithm | IEEE Spectrum | 2018-01-30

Categories

Removed:  
Added: Software

Other names

Removed:  
Added: Hash map
Added: Hashtable
Added: Hash