mirror of
https://github.com/krahets/hello-algo.git
synced 2025-10-29 09:27:41 +08:00
Update hash_map.md (#1802)
* Update hash_map.md 对目标句子的表达略微修改,使得前后句子的语义更加一致。 * Fix wording for bucket index calculation --------- Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
@ -559,7 +559,7 @@
|
||||
输入一个 `key` ,哈希函数的计算过程分为以下两步。
|
||||
|
||||
1. 通过某种哈希算法 `hash()` 计算得到哈希值。
|
||||
2. 将哈希值对桶数量(数组长度)`capacity` 取模,从而获取该 `key` 对应的数组索引 `index` 。
|
||||
2. 将哈希值对桶数量(数组长度)`capacity` 取模,从而获取该 `key` 对应的桶(数组索引)`index` 。
|
||||
|
||||
```shell
|
||||
index = hash(key) % capacity
|
||||
|
||||
Reference in New Issue
Block a user