Реферат: Двоичные деревья поиска
5 If (node == node.nodeParent.left)
6 Begin
7 nodeTemp = node.nodeParent.right;
8 If (nodeTemp.color == RED) Then
9 Begin
10 nodeTemp.color = BLACK;
11 nodeTemp.nodeParent.color = RED;
12 RBTLeftRotate(Tree,node.nodeParent);
13 nodeTemp = node.nodeParent.right;
14 End
15 If (nodeTemp.left.color == BLACK) and (nodeTemp.right.color == BLACK) Then
16 Begin
17 nodeTemp.color = RED;
18 nodeTemp = nodeTemp.nodeParent;
19 End
20 Else
21 Begin
22 If (nodeTemp.right.color == BLACK) Then
23 Begin
24 nodeTemp.left.color = BLACK;
25 nodeTemp.color = RED;
26 RBTRightRotate(Tree,nodeTemp)
27 nodeTemp = node.nodeParent.right;
28 End
29 nodeTemp.color = node.nodeParent.color;
30 node.color.nodeParent = BLACK;
31 nodeTemp.right.color = BLACK;
32 RBTLeftRotate(Tree,node.nodeParent);
33 node = Tree.root;