of an empty location.
Even this can be avoided, see for example Bell and Kaman[31].
The second class of collision handling methods involves extra storage space which is used to chain together collided records.
When a collision occurs at a hash address it may be because it is the head of a chain of records which have all hashed to that address, or it may be that a record is stored there which belongs to a chain starting at some other address.
In both cases a free location is needed which in the first case is simply linked in and stores the new record, in the second case the intermediate chain element is moved to the free location and the new record is stored at its own hash address thus starting a new chain (a one-element chain so far).
A variation on this method is to use a two-level store. At the first level we have a hash table, at the second level we have a bump table which contains all the collided records.
At a hash address in the hash table we will find either, a record if no collisions have taken place at that address, or, a pointer to a chain of records which collided at that address.
This latter chaining method has the advantage that records need never be moved once they have been entered in the bump table.
The storage overhead is larger since records are put in the bump table before the hash table is full.
For both classes of collision strategies one needs to be careful about deletions. For the linear, quadratic etc. collision handling strategies we must ensure that when we delete a record at an address we do not make records which collided at that address unreachable. Similarly with the chaining method we must ensure that a deleted record does not leave a gap in the chain, that is, after deletion the chain must be reconnected.
The advantages of hashing are several.
Firstly it is simple.
Secondly its insertion and search strategies are identical.
Insertion is merely a failed search.
If Ki is the hashed key, then if a search of the collision sequence fails to turn up a match in Ki, its record is simply inserted at the end of the sequence at the next free location.
Thirdly, the search time is independent of the number of keys to be inserted.
The application of hashing in IR has tended to be in the area of table construction and look-up procedures.
An obvious application is when constructing the set of conflation classes during text processing.
In Chapter 2, I gave an example of a document representative as simply a list of class names, each name standing for a set of equivalent words.
During a retrieval operation, a query will first be converted into a list of class names.
To do this each significant word needs to be looked up in a dictionary which gives the name of the class to which it belongs.
Clearly there is a case for hashing.
We simply apply the hashing function to the word and find the name of the conflation class to which it belongs at the hash address.
A similar example is given in great detail by Murray[32].
|