Algorithms icon indicating copy to clipboard operation
Algorithms copied to clipboard

Bloom filter -caching

Open Abhinavcode13 opened this issue 1 year ago • 2 comments

A Bloom filter is a space-efficient probabilistic data structure used to test whether an element is a member of a set. It provides an efficient way to perform set membership queries, but with a small probability of false positives.

The Bloom filter consists of a bit array of a fixed size, typically implemented as an array of bits or as a bit vector. Initially, all the bits in the array are set to 0. It also uses multiple hash functions to determine the positions within the array to set the corresponding bits.

To add an element to the Bloom filter, the element is hashed by each of the hash functions, and the resulting positions in the bit array are set to 1. When checking for membership of an element, the same hash functions are applied to the element, and the corresponding bits in the filter are checked. If any of the bits are 0, the element is definitely not in the set. However, if all the bits are 1, it means the element may be in the set, but there is a possibility of a false positive.

False positives can occur because different elements may hash to the same positions in the bit array. This is known as a collision. The probability of a false positive depends on the size of the bit array, the number of hash functions used, and the number of elements inserted into the filter. By adjusting these parameters, the probability of false positives can be reduced, but at the cost of increased memory usage.

Abhinavcode13 avatar Jun 14 '23 12:06 Abhinavcode13

@Kumar-laxmi please assign this issue to me

Abhinavcode13 avatar Jun 14 '23 12:06 Abhinavcode13

Stale issue message

github-actions[bot] avatar May 14 '24 16:05 github-actions[bot]