Which rotations in an AVL tree is known as double rotation?
2021
Which rotations in an AVL tree is known as double rotation?
- A.
LL and RR
- B.
LR and LL
- C.
RL and RR
- D.
LR and RL
Attempted by 401 students.
Show answer & explanation
Correct answer: D
In an AVL tree, double rotations are required when the imbalance occurs in a direction that cannot be corrected by a single rotation. These involve two consecutive rotations.
LR rotation (Left-Right): This is used when the imbalance is in the left-right direction. It involves a right rotation on the left child followed by a left rotation on the root.
RL rotation (Right-Left): This is used when the imbalance is in the right-left direction. It involves a left rotation on the right child followed by a right rotation on the root.
Both LR and RL are classified as double rotations because they require two steps to rebalance the tree.