- Linear probing
Linear probing is a scheme in
computer programming for resolvinghash collision s of values ofhash function s by sequentially searching thehash table for a free location. [cite book |last=Dale |first=Nell |title=C++ Plus Data Structures |year=2003 |publisher=Jones and Bartlett Computer Science |location=Sudbury, MA |isbn=0-7637-0481-4 ] This is accomplished using two values - one as a starting value and one as an interval between successive values inmodular arithmetic . The second value, which is the same for all keys and known as the "stepsize", is repeatedly added to the starting value until a free space is found, or the entire table is traversed.newLocation = (startingValue + stepSize) % arraySize
This algorithm, which is used in open-addressed
hash table s, provides good memory caching (if stepsize is equal to one), through good locality of reference, but also results in clustering, an unfortunately highprobability that where there has been one collision there will be more. The performance of linear probing is also more sensitive to input distribution when compared todouble hashing .Given an ordinary hash function h(k), a linear probing function would be h(k,i) = (h(k) + i)mod m.Here h(k) is the starting value, m the size of the hash table, and the "stepsize" is i in this case.
ee also
*
Double hashing
*Hash collision
*Hash function
*Quadratic probing References
External links
* [http://www.siam.org/meetings/alenex05/papers/13gheileman.pdf How Caching Affects Hashing] by Gregory L. Heileman and Wenbin Luo 2005.
Wikimedia Foundation. 2010.