Open addressing, or closed hashing, is a method of collision resolution in hash tables. With this method a hash collision is resolved by probing, or searching through alternate locations in the array (the probe sequence) until either the target record is found, or an unused array slot is found, which indicates that there is no such key in the table. Well known probe sequences include:
- Linear probing
- in which the interval between probes is fixed — often at 1.
- Quadratic probing
- in which the interval between probes increases linearly (hence, the indices are described by a quadratic function).
- Double hashing
- in which the interval between probes is fixed for each record but is computed by another hash function.
The main tradeoffs between these methods are that linear probing has the best cache performance but is most sensitive to clustering, while double hashing has poor cache performance but exhibits virtually no clustering; quadratic probing falls in-between in both areas. Double hashing can also require more computation than other forms of probing. Some open addressing methods, such as last-come-first-served hashing and cuckoo hashing move existing keys around in the array to make room for the new key. This gives better maximum search times than the methods based on probing.
A critical influence on performance of an open addressing hash table is the load factor; that is, the proportion of the slots in the array that are used. As the load factor increases towards 100%, the number of probes that may be required to find or insert a given key rises dramatically. Once the table becomes full, probing algorithms may even fail to terminate. Even with good hash functions, load factors are normally limited to 80%. A poor hash function can exhibit poor performance even at very low load factors by generating significant clustering. What causes hash functions to cluster is not well understood, and it is easy to unintentionally write a hash function which causes severe clustering.
Read more about Open Addressing: Example Pseudo Code
Famous quotes containing the words open and/or addressing:
“Wild Bill was indulging in his favorite pastime of a friendly game of cards in the old No. 10 saloon. For the second time in his career, he was sitting with his back to an open door. Jack McCall walked in, shot him through the back of the head, and rushed from the place, only to be captured shortly afterward. Wild Bills dead hand held aces and eights, and from that time on this has been known in the West as the dead mans hand.”
—State of South Dakota, U.S. public relief program (1935-1943)
“A writer who writes, I am alone ... can be considered rather comical. It is comical for a man to recognize his solitude by addressing a reader and by using methods that prevent the individual from being alone. The word alone is just as general as the word bread. To pronounce it is to summon to oneself the presence of everything the word excludes.”
—Maurice Blanchot (b. 1907)