NEW
Also known as: Hash Map
Data structure that maps keys to values using a hash function for near-constant-time average lookup.
DESCRIPTION
Hash tables implement associative arrays by hashing keys to indices in an underlying array. Collisions are resolved via chaining or open addressing. Performance depends on load factor, hash function quality, and resizing strategies. They power dictionaries, sets, caches, and symbol tables across languages. Alternatives like balanced trees trade average performance for ordered operations and worst-case guarantees.
ALTERNATIVE DEFINITIONS
Wikipedia
A hash table is a data structure that implements an associative array, a structure that can map keys to values.
Defines associative array mapping as core capability.
Wolfram MathWorld
A hash table is a data structure designed to implement an associative array using a hash function to map keys to indices.
Highlights index mapping via hash functions.
Princeton Algorithms
Hash tables store items in an array by mapping keys to array indices using a hash function.
Implementation-focused description for educational purposes.
RELATED TERMS
Hash Function Collision Resolution Open Addressing Chaining Dictionary Balanced Tree Bloom Filter Set Load Factor
COMPETING TERMS
Balanced Binary Search Tree B-Tree
RELATIONS
- Broader: Table
- Narrower: Distributed Hash Table
KNOWLEDGE AREAS
Software Engineering Data Engineering Data Storage & Operations Programming Languages
TARGET AUDIENCE
Software Developer Data Engineer Data Architect
EXTERNAL SOURCES
- Wikipedia - Hash table
- Princeton Algorithms - Educational material on hashing
- CP-Algorithms - Practical hash table techniques
- Oracle Java - HashMap class reference
TOP QUESTIONS
What determines Hash Table performance?
Load factor, hash function quality, collision resolution strategy, and resizing policies drive average-case O(1) lookup.
Category: Requirements
How are collisions handled in a Hash Table?
Common methods include separate chaining with linked lists and open addressing like linear or quadratic probing.
Category: Overview
When is a Balanced Tree preferable to a Hash Table?
Use trees when ordered traversals, range queries, or worst-case guarantees are required.
Category: Opinion
What are common mistakes with Hash Tables?
Poor hash functions, high load factors without resizing, and ignoring pathological cases lead to performance degradation.
Category: Mistakes
How does a Hash Table support Sets and Dictionaries?
Sets store unique keys; dictionaries store key-value pairs, both implemented efficiently with hashing.
Category: Example
What is a Hash Table’s worst-case complexity?
O(n) per operation when many keys collide or adversarial inputs exploit the hash function.
Category: Risk
How do modern languages implement Hash Tables?
Languages use optimized hash maps with dynamic resizing and advanced probing like Robin Hood hashing.
Category: Overview
What security concerns exist for Hash Tables?
Hash flooding attacks can force worst-case behavior; mitigations include randomized hashing and request throttling.
Category: Risk
How should hash functions be chosen for Hash Tables?
Use well-distributed, fast functions appropriate for key types; avoid naive or biased hashing.
Category: Best practices