Question

i am looking for a specific data structure, but i forgot its name. if i knew the name it would be trivial, i would just look it up in wikipedia :)

basically, it is like a set - except you cannot iterate it.

you put some values in it, lets say 80k zip codes.

then you can test if a given string is definately NOT a zip code, but you will eventually get false positives if you insert too many zip codes.

the memory consumption of this structure is quite small.

what is its name, and is there an implementation in java?

Was it helpful?

Solution

I believe you are looking for a Bloom Filter.

Here is a Java implementation.

OTHER TIPS

I think you mean a Bloom filter. Here's one based on Java's BitSet.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top