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