Реферат: Двоичные деревья поиска
35 End
36 Else
37 Begin
38 nodeTemp = node.nodeParent.left;
39 If (nodeTemp.color == RED) Then
40 Begin
41 nodeTemp.color = BLACK;
42 nodeTemp.nodeParent.color = RED;
43 RBTRightRotate(Tree,node.nodeParent);
44 nodeTemp = node.nodeParent.left;
45 End
46 If (nodeTemp.right.color == BLACK) and (nodeTemp.left.color == BLACK) Then
47 Begin
48 nodeTemp.color = RED;
49 nodeTemp = nodeTemp.nodeParent;
50 End
51 Else
52 Begin
53 If (nodeTemp.left.color == BLACK) Then
54 Begin
55 nodeTemp.right.color = BLACK;
56 nodeTemp.color = RED;
57 RBTLeftRotate(Tree,nodeTemp)
58 nodeTemp = node.nodeParent.left;
59 End
60 nodeTemp.color = node.nodeParent.color;
61 node.color.nodeParent = BLACK;
62 nodeTemp.left.color = BLACK;
63 RBTRightRotate(Tree,node.nodeParent);