This commit is contained in:
krahets
2023-07-21 22:21:09 +08:00
parent c865d20b93
commit c04e8961b0
6 changed files with 65 additions and 19 deletions
+2 -2
View File
@@ -1410,8 +1410,8 @@ index = hash(key) % capacity
对于上述示例中的哈希函数,当输入的 `key` 后两位相同时,哈希函数的输出结果也相同。例如,查询学号为 12836 和 20336 的两个学生时,我们得到:
```shell
12386 % 100 = 36
20386 % 100 = 36
12836 % 100 = 36
20336 % 100 = 36
```
如下图所示,两个学号指向了同一个姓名,这显然是不对的。我们将这种多个输入对应同一输出的情况称为「哈希冲突 Hash Collision」。