Bloom Filter

A Bloom filter is defined as a data structure designed to identify of a element’s presence in a set in a rapid and memory efficient manner.

A specific data structure named as probabilistic data structure is implemented as bloom filter. This data structure helps us to identify that an element is either present or absent in a set.

Bit Vector is implemented as a base data structure. Here's a small one we'll use to explain


Each empty cell in that table specifies a bit and the number below it its index or position. To append an element to the Bloom filter, we simply hash it a few times and set the bits in the bit vector at the position or index of those hashes to 1.

Elaborate implementation of Bloom Filter is discussed in following

Bloom filters support two actions, at first appending object and keeping track of an object and next verifying whether an object has been seen before.

Appending objects to the Bloom filter

  • We compute hash values for the object to append;
  • We implement these hash-values to set certain bits in the Bloom filter state (hash value is the position of the bit to set).

Verifying whether the Bloom filter contains an object −

  • We compute hash values for the object to append;
  • Next we verify whether the bits indexed by these hash values are set in the Bloom filter state.

We have to keep in mind that the hash value for an object is not directly appended to the bloom filter state; each hash function simply determines which bit to set or to verify. For example: if only one hash function is used, only one bit is verified or checked.