A Textbook of Data Structures and Algorithms, Volume 2 by Vijayalakshmi Pai G. A.;

A Textbook of Data Structures and Algorithms, Volume 2 by Vijayalakshmi Pai G. A.;

Author:Vijayalakshmi Pai, G. A.; [G A Vijayalakshmi Pai]
Language: eng
Format: epub
Publisher: John Wiley & Sons, Incorporated
Published: 2023-01-18T00:00:00+00:00


Figure 10.14. Generic representation of an RR rotation

EXAMPLE 10.9.–

Consider the AVL search tree shown in Figure 10.15(a). The insertion of Z calls for an RR rotation. The unbalanced AVL search tree and the balanced tree after RR rotation have been shown in Figures 10.15(b) and (c), respectively.

Figure 10.15. An example of RR rotation

RL rotation

RL rotation is symmetric to LR rotation. Figure 10.16 illustrates the generic representation of the RL rotation scheme. Here, node u finds itself inserted in the left subtree of right subtree of node A, which is the closest ancestor node that is unbalanced. Note how the RL rotation is the mirror image of the LR rotation scheme. As pointed out for the LR rotation scheme, the rotation procedure for RL remains the same irrespective of u being inserted in CL or CR, the left subtree and right subtree of C, respectively.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.