bloom filter

A Bloom filter is a data structure designed to tell you, rapidly and memory-efficiently, whether an element is present in a set.

The price paid for this efficiency is that a Bloom filter is a probabilistic data structure: it tells us that the element either definitely is not in the set or may be in the set.

The base data structure of a Bloom filter is a Bit Vector.

Bloom filter 是一個數(shù)據(jù)結(jié)構(gòu),可以快速查詢一個元素是否在一個集合中。

它是概率性的數(shù)據(jù)結(jié)構(gòu),每次的結(jié)果會告訴,這個元素一定不再集合中,或者可能在集合中。
實(shí)現(xiàn)它的方法就是用一個bit vector

使用幾個hash方程來hash存入的元素,并且將這些hash值再bit vector里面標(biāo)記。

Bloom Filter 參數(shù)

Bloom filter with k hashes, m bits in the filter, and n elements that have been inserted.

Bloom Filter 時間,空間

Given a Bloom filter with m bits and k hashing functions, both insertion and membership testing are O(k). That is, each time you want to add an element to the set or check set membership, you just need to run the element through the k hash functions and add it to the set or check those bits.

Reference:
https://llimllib.github.io/bloomfilter-tutorial/
https://en.wikipedia.org/wiki/Bloom_filter
https://blog.medium.com/what-are-bloom-filters-1ec2a50c68ff

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容