Skip to content

Commit e1317ad

Browse files
authored
Merge pull request #1 from Snailclimb/master
update
2 parents 63664e6 + 946d669 commit e1317ad

File tree

276 files changed

+3373
-13193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+3373
-13193
lines changed

README.md

Lines changed: 261 additions & 313 deletions
Large diffs are not rendered by default.

docs/dataStructures-algorithms/Backtracking-NQueens.md

Lines changed: 0 additions & 145 deletions
This file was deleted.

docs/dataStructures-algorithms/data-structure/bloom-filter.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
![布隆过滤器hash计算](https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-11/布隆过滤器-hash运算.png)
4141

42-
如图所示,当字符串存储要加入到布隆过滤器中时,该字符串首先由多个哈希函数生成不同的哈希值,然后在对应的位数组的下表的元素设置为 1(当位数组初始化时 ,所有位置均为0)。当第二次存储相同字符串时,因为先前的对应位置已设置为1,所以很容易知道此值已经存在(去重非常方便)。
42+
如图所示,当字符串存储要加入到布隆过滤器中时,该字符串首先由多个哈希函数生成不同的哈希值,然后在对应的位数组的下表的元素设置为 1(当位数组初始化时 ,所有位置均为0)。当第二次存储相同字符串时,因为先前的对应位置已设置为 1,所以很容易知道此值已经存在(去重非常方便)。
4343

4444
如果我们需要判断某个字符串是否在布隆过滤器中时,只需要对给定字符串再次进行相同的哈希计算,得到值之后判断位数组中的每个元素是否都为 1,如果值都为 1,那么说明这个值在布隆过滤器中,如果存在一个值不为 1,说明该元素不在布隆过滤器中。
4545

@@ -49,7 +49,7 @@
4949

5050
### 3.布隆过滤器使用场景
5151

52-
1. 判断给定数据是否存在:比如判断一个数字是否在于包含大量数字的数字集中(数字集很大,5亿以上!)、 防止缓存穿透(判断请求的数据是否有效避免直接绕过缓存请求数据库)等等、邮箱的垃圾邮件过滤、黑名单功能等等。
52+
1. 判断给定数据是否存在:比如判断一个数字是否存在于包含大量数字的数字集中(数字集很大,5亿以上!)、 防止缓存穿透(判断请求的数据是否有效避免直接绕过缓存请求数据库)等等、邮箱的垃圾邮件过滤、黑名单功能等等。
5353
2. 去重:比如爬给定网址的时候对已经爬取过的 URL 去重。
5454

5555
### 4.通过 Java 编程手动实现布隆过滤器
Binary file not shown.
-3.49 MB
Binary file not shown.
-46.7 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
-59.1 KB
Binary file not shown.
-72.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)