Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

compact data structure like set

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?

like image 942
Andreas Petersson Avatar asked Aug 10 '09 13:08

Andreas Petersson


People also ask

What is compact data?

In telecommunication, data compaction is the reduction of the number of data elements, bandwidth, cost, and time for the generation, transmission, and storage of data without loss of information by eliminating unnecessary redundancy, removing irrelevancy, or using special coding.

Which data structure is most efficient?

Arrays. An array is a linear data structure that holds an ordered collection of values. It's the most efficient in storing and accessing a sequence of objects.

Which data structure is best and why?

Arrays. An array is the simplest and most widely used data structure. Other data structures like stacks and queues are derived from arrays. Here's an image of a simple array of size 4, containing elements (1, 2, 3 and 4).


1 Answers

I believe you are looking for a Bloom Filter.

Here is a Java implementation.

like image 164
groundhog Avatar answered Sep 30 '22 08:09

groundhog