In closed hashing (open addressing) a value is looked up as:
- Compute key hash and from it determine the "perfect" bucket;
- If the bucket is occupied and has key equal to the one looked up, return the value;
- If the bucket is not occupied, abort the lookup with a failure;
- Go to the next bucket (with linear probing just increment bucket index) and step 2.
Now, suppose you start looking up in bucket 5 and find your key only in bucket 8. If erasing procedure now marked bucket 6 as unoccupied, you'd never get to bucket 8 due to step 3. Therefore, we need a special value that marks bucket as "occupied", yet still available for insertion. This is probably what your source terms as AVAILABLE
, and null
as unoccupied at all.
EDIT: BTW, with linear probing it is possible to (quite) efficiently get away without this special AVAILABLE
value, but that complicates erasing considerably.