-
Notifications
You must be signed in to change notification settings - Fork 45.4k
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
有个问题请教 #7
Labels
question
Further information is requested
Comments
我们知道红黑树(Red Black Tree) 是一种自平衡二叉查找树,红黑树和AVL树类似,都是在进行插入和删除操作时通过特定操作保持二叉查找树的平衡,从而获得较高的查找性能。 为什么是8呢?我暂时只能想到/查阅到两个答案
|
@winyiwin if (binCount >= TREEIFY_THRESHOLD - 1) // -1 for 1st
treeifyBin(tab, hash); 当桶(bucket)上的结点数大于这个值时会转成红黑树
if (loHead != null) {
if (lc <= UNTREEIFY_THRESHOLD)
tab[index] = loHead.untreeify(map);
else {
tab[index] = loHead;
if (hiHead != null) // (else is already treeified)
loHead.treeify(tab);
}
}
if (hiHead != null) {
if (hc <= UNTREEIFY_THRESHOLD)
tab[index + bit] = hiHead.untreeify(map);
else {
tab[index + bit] = hiHead;
if (loHead != null)
hiHead.treeify(tab);
}
} 当桶(bucket)上的结点数小于这个值时树转链表 注意阅读源码。 |
Snailclimb
pushed a commit
that referenced
this issue
Nov 7, 2019
Snailclimb
pushed a commit
that referenced
this issue
Nov 28, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
这两个值大神知道是什么依据吗?
The text was updated successfully, but these errors were encountered: