next up previous index
Next: Code and demonstration Up: Hash Tables Previous: The findIndex method   Index

Separate chaining

An alternative to open addressing as a method of collision resolution is separate chaining hashing. This again uses an array as the primary hash table, except that the array is an array of lists of entries, each list initially being empty. When an entry is inserted, it is inserted at the end of the list at the index corresponding to the hash code of the key in question. Searching the hash table now involves walking down the list at the given index though, with good design, it should be a relatively short list. This method has some attractive features and offers an alternative way of implementing the LookupTable interface, via a ChainingHashTable class.



Peter Williams 2005-06-07