In: Computer Science
Course: DSA Data Structure and Algorithm
What is an AVL Tree, what are its different types of rotation, Illustrate with examples.
AVL tree is a self balanced binary search tree.
Rotaions in AVL Tree:
LEFT ROTATION
Every node in the tree moves one position to the left of the current position. Type of single rotation.
RIGHT ROTATION
Every node in the tree moves one position to the right of the current position. Type of single rotation
LEFT-RIGHT ROTATION
Combination of Left Rotation followed by Right Rotation. Type of double rotation.Firstly, every node in the tree moves one postion to the left and then one position to right of the current position.
RIGHT-LEFT ROTATION
Combination of Right Rotation followed by Left Rotation. Type of double rotation.Firstly, every node in the tree moves one postion to the right and then one position to left of the current position.