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>
pull/420/head
iScream 2 years ago committed by GitHub
parent c2be6ebfbe
commit ec0856ccfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -75,3 +75,5 @@
Java 采用「链式地址」。在 JDK 1.8 之后HashMap 内数组长度大于 64 时,长度大于 8 的链表会被转化为「红黑树」,以提升查找性能。
Python 采用「开放寻址」。字典 dict 使用伪随机数进行探测。
Golang 采用「链式地址」。Go 规定每个桶最多存储 8 个键值对,超出容量则连接一个溢出桶;当溢出桶过多时,会执行一次特殊的等量扩容操作,以保证性能。

Loading…
Cancel
Save