红黑树的插入后恢复平衡真的最多只需2次旋转么?
" 1 " is the newest insert node. It is Case 1:current node is red, father is red, uncle is red.
So we set father'color as black, uncle's color as black, father's father's color as red, and set father's father as the current node, and continue to go.
After the above operations, it is case 1 again.
Let's imagine: if it is always becomes to be case 1, the numbers of rotate will not just 2, maybe more.
My above statements are right? I want to confirm my thinking.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有发表关于红黑树的文章,讲解很详细