Polish the content.

This commit is contained in:
krahets
2023-08-21 03:57:09 +08:00
parent f5dda8d99a
commit 1aff6d6cc2
19 changed files with 44 additions and 38 deletions

View File

@@ -198,8 +198,8 @@ index = hash(key) % capacity
$$
\begin{aligned}
\text{modulus} & = 9 \newline
\text{key} & = \{ 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, \cdots \} \newline
\text{hash} & = \{ 0, 3, 6, 0, 3, 6, 0, 3, 6, 0, 3, 6,\cdots \}
\text{key} & = \{ 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, \dots \} \newline
\text{hash} & = \{ 0, 3, 6, 0, 3, 6, 0, 3, 6, 0, 3, 6,\dots \}
\end{aligned}
$$
@@ -208,8 +208,8 @@ $$
$$
\begin{aligned}
\text{modulus} & = 13 \newline
\text{key} & = \{ 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, \cdots \} \newline
\text{hash} & = \{ 0, 3, 6, 9, 12, 2, 5, 8, 11, 1, 4, 7, \cdots \}
\text{key} & = \{ 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, \dots \} \newline
\text{hash} & = \{ 0, 3, 6, 9, 12, 2, 5, 8, 11, 1, 4, 7, \dots \}
\end{aligned}
$$

View File

@@ -204,7 +204,7 @@
### 多次哈希
顾名思义,多次哈希方法是使用多个哈希函数 $f_1(x)$ , $f_2(x)$ , $f_3(x)$ , $\cdots$ 进行探测。
顾名思义,多次哈希方法是使用多个哈希函数 $f_1(x)$ , $f_2(x)$ , $f_3(x)$ , $\dots$ 进行探测。
- **插入元素**:若哈希函数 $f_1(x)$ 出现冲突,则尝试 $f_2(x)$ ,以此类推,直到找到空位后插入元素。
- **查找元素**:在相同的哈希函数顺序下进行查找,直到找到目标元素时返回;或遇到空位或已尝试所有哈希函数,说明哈希表中不存在该元素,则返回 $\text{None}$ 。

View File

@@ -1,13 +1,13 @@
# 散列
# 哈希
<div class="center-table" markdown>
![散列](../assets/covers/chapter_hashing.jpg){ width="600" }
![哈希](../assets/covers/chapter_hashing.jpg){ width="600" }
</div>
!!! abstract
在计算机世界中,散列表如同一位智能的图书管理员。
在计算机世界中,哈希表如同一位智能的图书管理员。
他知道如何计算索书号,从而可以快速找到目标书籍。