我有一棵如下的红黑树:
2 = Root Black
Children = 1 (Black/Left), 4 (Red/Right)
Children of 1 = NIL & NIL => Height of Black Subtree is then 2
Children of 4 = 3 (Black/Left), 5 (Black/Right)
Children of 3 = NIL & NIL, Height of Black Subtree is then 2
Children of 5 = 7 (Red/Right)& NIL, Height is still then of course 2.
当我插入数字6(红色),并将其作为7的左子节点时,在我正在使用的Web应用程序中,它会对6和7进行旋转。为什么?从我看来,这似乎没有违反RBT的任何属性。
注:源Web应用程序是一个需要1.7版本的Java Web应用程序。 来源:http://gauss.ececs.uc.edu/RedBlackTester/redblack.html