- Linear hash
Linear Hashing is a dynamic
hash table algorithm invented by Witold Litwin (1980) [ Citation | first1=Witold | last1=Litwin | title=Linear hashing: A new tool for file and table addressing | journal=Proc. 6th Conference on Very Large Databases | pages=pp. 212-223 | year=1980 | url=http://www.cs.cmu.edu/afs/cs.cmu.edu/user/christos/www/courses/826-resources/PAPERS+BOOK/linear-hashing.PDF] , and later popularized byPaul Larson . Linear hashing allows for the expansion of the hash table one slot at a time.The frequent single slot expansion can very effectively control the length ofthe collision chain. The cost of hash table expansion is spread out across eachhash table insertion operation, as opposed to be incurred all at once. [ Citation | first1=Per-Åke | last1=Larson | title=Dynamic Hash Tables | journal=Communications of the ACM | pages=pp. 446-457 | date=April 1988 | Volume=31 | Number=4] Thereforelinear hashing is well suited for interactive applications.Algorithm Details
As usual, a
hash function controls the address calculation of linear hashing.In linear hashing, the address calculation is always bounded by a size thatis apower of two .* address(level,key) = hash(key) mod (2level)
The 'split' variable controls the read operation, and the expansion operation.
A read operation would use address(level,key) if address(level,key) is greaterthan or equal to the 'split' variable. Otherwise, address(level+1,key) is used.
A linear hashing table expansion operation would consist of rehashing theentries at slot location indicated by the 'split' variable to the target slot locationof address(level+1,key). The 'split' variable is incremented by 1 at the end ofthe expansion operation. If the 'split' variable reaches 2level, then the 'level'variable is incremented by 1, and the 'split' variable is reset to 0.
There is some flexibility in choosing how often the expansion operations are performed.One obvious choice is one expansion operation per insertion request. Another choiceis to control the expansion with a programmer defined load factor.
The hash table array for linear hashing is usually implemented with a
dynamic array algorithm.Adoption in language systems
Griswold and Townsend [ Citation | title=The Design and Implementation of Dynamic Hashing for Sets and Tables in Icon | first1=William G. | last1=Griswold | first2=Gregg M. | last2=Townsend | journal=Software - Practice and Experience | volume=23 | issue=4 | date=April 1993 | pages=pp. 351-367 | url=http://citeseer.ist.psu.edu/griswold93design.html ] discussed the adoption of linear hashing in the
Icon language . They discussed the implementation alternatives ofdynamic array algorithm used in linear hashing, and presented performance comparisons using a list of Icon benchmark applications.References
External links
* [http://www.concentric.net/~Ttwang/tech/sorthash.htm Sorted Linear Hash Table]
Wikimedia Foundation. 2010.