mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-25 00:36:27 +08:00
docs(Hashing/Hash_Collision): add go part. (#395)
* docs(Hashing/Hash_Collision): add go part. * docs(Hashing/Hash_Collision): add go part. * docs(Hashing/Hash_Collision): add go part. * docs(Hashing/Hash_Collision): add go part. * docs(Hashing/Hash_Collision): add go part. * Update hash_collision.md * fix context logic question * Update Go language hash table collision handling to limit each bucket to 8 entries and compare keys' high 8 bits of hash to reduce access to key-value pairs * Update hash_collision.md --------- Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
parent
c2be6ebfbe
commit
ec0856ccfa
1 changed files with 2 additions and 0 deletions
|
@ -75,3 +75,5 @@
|
|||
Java 采用「链式地址」。在 JDK 1.8 之后,HashMap 内数组长度大于 64 时,长度大于 8 的链表会被转化为「红黑树」,以提升查找性能。
|
||||
|
||||
Python 采用「开放寻址」。字典 dict 使用伪随机数进行探测。
|
||||
|
||||
Golang 采用「链式地址」。Go 规定每个桶最多存储 8 个键值对,超出容量则连接一个溢出桶;当溢出桶过多时,会执行一次特殊的等量扩容操作,以保证性能。
|
||||
|
|
Loading…
Reference in a new issue