-
Notifications
You must be signed in to change notification settings - Fork 45.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
集合-常见面试题下-HashMap 的长度为什么是 2 的幂次方这里逻辑不好 #2406
Labels
typo
Correct typos
Comments
我都不知道哪一次抽风改成这样描述了,感谢指出! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
建议改进
这个数组下标的计算方法是“ (n - 1) & hash”。(n 代表数组长度)。这也就解释了 HashMap 的长度为什么是 2 的幂次方。这个算法应该如何设计呢?
这句话多余,先介绍公式说就直接说能解释原因不合理。
The text was updated successfully, but these errors were encountered: