14.14 | Data Structures and Algorithms Using C++
Consider Figure 14.9(a) a red–black tree before insertion. Insertion of 320 causes LLb imbalance it is
shown in Figure 14.9(b). To rebalance the tree LLb rotation is invoked, this is shown in Figure 14.9(c). Here
330 is the new root of the subtree and 320, 350 are its le and right children, respectively. Node 330 changed its
colour from red to black and 350 from black to red, and accordingly there is change in its pointers colour. A er
rotation the number of black nodes on all the paths from root node to external nodes is the same as before
insertion. No two consecutive red nodes are also found. Hence, the resultant is a rebalanced red–black tree.
Similarly, Figure 14.10 illustrates LRb imbalance ...