Open addressing vs. separate chaining
-
Linear probing, double and random hashing are appropriate if the keys are kept as entries in the hashtable itself...
-
doing that is called "open addressing"
-
it is also called "closed hashing"
-
Another idea: Entries in the hashtable are just pointers to the head of a linked list (“chain”); elements of the linked list contain the keys...
-
this is called "separate chaining"
-
it is also called "open hashing"
-
Collision resolution becomes easy with separate chaining: just insert a key in its linked list if it is not already there
-
(It is possible to use fancier data structures than linked lists for this; but linked lists work very well in the average case, as we will see)
-
Let’s look at analyzing time costs of these strategies
CONTENTS PREVIOUS NEXT