Hash table: Difference between revisions

Content deleted Content added
(edit summary removed)
Hash set redirects here, so indicate that a set implemented with a hash table is called a "hash set", and boldface "hash set" as per MOS:BOLDREDIRECT.
Tag: Reverted
Line 34:
[[File:Hash table 3 1 1 0 1 0 0 SP.svg|thumb|315px|right|A small phone book as a hash table]]
 
In [[computing]], a '''hash table''' is a [[data structure]] that implements an [[associative array]], also called a dictionary or simply map, which is an [[abstract data type]] that maps [[Unique key|keys]] to [[Value (computer science)|values]].<ref name="ms">{{cite book |doi=10.1007/978-3-540-77978-0_4 |chapter=Hash Tables and Associative Arrays |title=Algorithms and Data Structures |date=2008 |pages=81–98 |isbn=978-3-540-77977-3 }}</ref> A hash table uses a [[hash function]] to compute an ''index'', also called a ''hash code'', into an array of ''buckets'' or ''slots'', from which the desired value can be found. During lookup, the key is hashed and the resulting hash indicates where the corresponding value is stored. A [[set (abstract data type)|set]] implemented with a hash table is called a '''hash set'''.
 
Most hash table designs employ an [[Perfect hash function|imperfect hash function]]. [[Hash collision|Hash collisions]], where the hash function generates the same index for more than one key, therefore typically must be accommodated in some way.