Redian新闻
>
Potential error in the algorithm RB-INSERT-FIXUP in CLRS (p.316, 3rd ed.)?
avatar
Potential error in the algorithm RB-INSERT-FIXUP in CLRS (p.316, 3rd ed.)?# JobHunting - 待字闺中
B*7
1
最近在学CLRS,觉得RB-INSERT-FIXUP有bug。拿出来和大家讨论一下。
The case 1 in the algorithm deals with case that the parent and the uncle of
the newly inserted node are both red nodes. Lines 4-8 repaint the parent
and the uncle into black and the grandparent into red, and then the current
node z moves up to the grandparent as in line 8. However, that shouldn't be
the end of the case. Instead, the routine should recursively call itself, i.
e., there should be statement after line 8 like this:
RB-INSERT-FIXUP(T, z)
Any comments?
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。