> Hi all,
>
[quoted text clipped - 13 lines]
> a "formerly-occupied" bucket - as long as it doesn't point to an
> occupied bucket.
(This isn't really a Java question -- it's about data
structures that aren't at all Java-specific. Still ...)
Insert object A in an empty hash table; it lands in its
"natural" bucket. Now insert object B that happens to have
the same "natural" bucket. B can't go there because that
bucket is already occupied by A, so B goes to some other,
second-choice bucket.
Now delete object A, and then search for object B. You
start by probing B's "natural" bucket, where A used to be.
B isn't there[*] because it went to its second-choice spot,
so you don't find B on the first probe. Now: Do you stop,
or do you continue probing? If you can't tell "never used"
from "used but vacated," you don't know what to do.
[*] This isn't necessarily true of all hash tables. Some
implementations do extra work when deleting objects,
moving the colliders "closer" to their "natural"
positions. But in implementations where objects aren't
shuffled around after being inserted, the first probe
for B will find the emptied spot left by A.
Any decent book on hashing will explain this; one oft-cited
(and much-feared, for reasons I've never understood) is "The Art
of Computer Programming, Volume III: Sorting and Searching" by
D.E. Knuth.

Signature
Eric.Sosman@sun.com
Andy - 22 Apr 2004 15:52 GMT
Thanks! That explanation helped a lot
> (This isn't really a Java question -- it's about data
> structures that aren't at all Java-specific. Still ...)
Sorry about off-topic question. I couldn't find a more appropriate
group and since I'm implementing these data structures in java I
thought I'd post here. If you recommend, I'll post a reference to the
code when I'm finished (since as far as I'm aware, Closed Hash Sets
don't come within the core java libs)
Andy