当前位置:网站首页>Bloom filter
Bloom filter
2022-06-30 09:41:00 【Zip-List】
The bloon filter
Definition
The bloon filter is ⼀ A probabilistic data structure , It is characterized by ⾼ Effective insert ⼊ and Inquire about , Can clearly tell a string ⼀ Must not exist perhaps Possible ;
Bloom filter phase ⽐ Traditional query structure ( for example : hash, set, map And so on ) more ⾼ effect , Occupy ⽤ More space ⼩; But the drawback is that it returns The result is probability Of , That is to say, there are errors in the results , Although this error is controllable ; At the same time, it No ⽀ Hold delete operation ;
form
Bitmap (bit Array ) + n individual hash function 
principle
When ⼀ Elements plus ⼊ Bitmap time , adopt k individual hash Function maps this element to the of the bitmap k A little bit , And set them as
1; When retrieving , Re pass k individual hash Function operation to detect the of bitmap k Whether all points are 1; If there is any reason not to 1 The point of , So think
non-existent ; If it's all 1, There may be ( There is an error );
There are only two states for each slot in the bitmap (0 perhaps 1),⼀ Slots are set to 1 state , But it is not clear how many times it has been set ; I don't know how many str1 Hash mapping and which hash Function mapping ; So don't ⽀ Hold the delete operation ;
In practice, we should ⽤ In the process , How the bloom filter makes ⽤? How many hash function , Bitmap of how much space to allocate , How many elements are stored ? In addition, how to control the false positive rate ( The bloan filter can define ⼀ Must not exist , Not clear ⼀ There must be , Then there is an error in the judgment of existence , False positive rate is the probability of wrong judgment )?
In practice, we should ⽤ in , We are sure that n and p, Pass on ⾯ The calculation of m and k; It can also be in ⽹ Select the appropriate value on the station :
https://hur.st/bloomfilterIt is known that k, How to choose k individual hash function ?
// Mining ⽤⼀ individual hash function , to hash Pass on different species ⼦ Offset value
// #define MIX_UINT64(v) ((uint32_t)((v>>32)^(v)))
uint64_t hash1 = MurmurHash2_x64(key, len, Seed);
uint64_t hash2 = MurmurHash2_x64(key, len, MIX_UINT64(hash1));
for (i = 0; i < k; i++) // k yes hash Number of functions
{
Pos[i] = (hash1 + i*hash2) % m; // m It's a bitmap ⼤⼩
}
// Through this kind of ⽅ To simulate k individual hash function Before us ⾯ Open addressing double hash yes ⼀ What kind of thinking
边栏推荐
- POJ 1753 flip game (DFS 𞓜 bit operation)
- qmlplugindump executable not found.It is required to generate the qmltypes file for VTK Qml
- Why must redis exist in distributed systems?
- Numpy (time date and time increment)
- JVM tuning tool introduction and constant pool explanation
- 【Ubuntu-MySQL8安装与主从复制】
- 4. use ibinder interface flexibly for short-range communication
- What is the difference between ZigBee, Bluetooth and WiFi (copy and reprint)
- 5. Messager framework and imessager interface
- Ocx control can be called by IE on some computers, but can not be called by IE on some computers
猜你喜欢

Deberta (decoding enhanced Bert with distinguished attention)

Express file download

Tutorial for beginners of small programs day01

Express file upload

Dart 开发技巧

Xlnet (generalized autorefressive trainingfor language understanding) paper notes

Express get request

Numpy (data type)

小程序手持弹幕的原理及实现(uni-app)

Cb/s Architecture - Implementation Based on cef3+mfc
随机推荐
Acquisition de 100% des actions de Guilin latex par Guilin Robust Medical pour combler le vide de la gamme de produits Latex
9.JNI_ Necessary optimization design
RPC understanding
Redis + MySQL implements the like function
Cronexpression expression explanation and cases
ABAP-时间函数
小程序开发踩坑之旅
Express の post request
布隆过滤器
Dart 开发技巧
DataTableToModelList实体类
ACM intensive training graph theory exercise 3 in the summer vacation of 2020 [problem solving]
prometheus 监控之 ntp_exporter
Common query and aggregation of ES
Tclistener server and tcpclient client
桂林 稳健医疗收购桂林乳胶100%股权 填补乳胶产品线空白
MySQL优化
CentOS MySQL installation details
11.自定义hooks
八大排序(一)