Math176
Non-lazy deletion in a linear probing hash table
Below is the algorithm which I described in class for non-lazyt deletion in a hash table which uses linear probing. This algorithm is not in our text book, and seems to not be well-known, since most textbooks do not include it. However, on the day after we discussed the algorithm in lecture, I received a free copy of a book which does describe this method of non-lazy deletion, so it is not completely unknown. (The book is: Data Structures and Algorithms with Object-Oriented Design Patterns in Java, by Bruno Preiss, pp 237-239.)
Here is the algorithm for non-lazy deletion. (It is slightly shortened from what I presented in class.)
Variables: | A - hash table. A[i] - i-th entry of the hash table. (0-based) S - table size |
-- | |
Algorithm: | To remove the object (key) in A[i]:
|
-- | |
Algorithm: | To check if b is "circularly between" a and c (mod S) , or equivalently, b is in the "circular" half-open interval [a,c):
|