This commit is contained in:
krahets
2023-05-21 19:29:43 +08:00
parent 0c64fc7315
commit 5a68f683b9
26 changed files with 93 additions and 93 deletions
+4 -4
View File
@@ -2,7 +2,7 @@
comments: true
---
# 7.1.   哈希表
# 6.1.   哈希表
哈希表通过建立「键 key」与「值 value」之间的映射,实现高效的元素查询。具体而言,我们向哈希表输入一个 key,则可以在 $O(1)$ 时间内获取对应的 value 。
@@ -26,7 +26,7 @@ comments: true
</div>
## 7.1.1. &nbsp; 哈希表常用操作
## 6.1.1. &nbsp; 哈希表常用操作
哈希表的基本操作包括 **初始化、查询操作、添加与删除键值对**
@@ -387,7 +387,7 @@ comments: true
```
## 7.1.2. &nbsp; 哈希函数
## 6.1.2. &nbsp; 哈希函数
哈希表的底层实现为数组,同时可能包含链表、二叉树(红黑树)等数据结构,以提高查询性能(将在下节讨论)。
@@ -1263,7 +1263,7 @@ $$
}
```
## 7.1.3. &nbsp; 哈希冲突
## 6.1.3. &nbsp; 哈希冲突
细心的你可能已经注意到,**在某些情况下,哈希函数 $f(x) = x \bmod 100$ 可能无法正常工作**。具体来说,当输入的 key 后两位相同时,哈希函数的计算结果也会相同,从而指向同一个 value 。例如,查询学号为 $12836$ 和 $20336$ 的两个学生时,我们得到: