一个红黑案例问题
我试图理解红黑树是如何工作的,假设图中从第一个到第二个的过渡,我得到它没有任何问题,之后根据教学资源,我需要对红色 G 节点进行本地修复。 那么作为第二步的修复,G 是否只是简单地着色为黑色以保持红黑属性?
替代文本 http://img683.imageshack.us/img683/4929/rb1.jpg< /a>
谢谢
I am trying to understand how red black trees work, assume the transition from first to the second at the picture, I get it this without any problem, after this according to teaching resources, I need to do a local fix on the red G node.
So as a fix to the 2nd step, does G simply colored to black to maintain the red-black properties ?
alt text http://img683.imageshack.us/img683/4929/rb1.jpg
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经典的定义说根必须是黑色的,因此必须将其涂成黑色才能获得该属性。基本思想是在某些位置禁止红色节点(例如作为另一个红色节点的子节点),因此将节点绘制为红色会创建应检查的潜在约束违规。
The classic definition says the root has to be black, so it would have to be painted black to get that property. The basic idea is that red nodes are forbidden in certain locations (such as being a child of another red node), so painting a node red creates a potential constraint violation that should be checked for.