Dsa Case Study 27
Dsa Case Study 27
If balance factor of any node is 1, it means that the left sub-tree is one level higher than
the right sub-tree.
If balance factor of any node is 0, it means that the left sub-tree and right sub-tree contain
equal height.
If balance factor of any node is -1, it means that the left sub-tree is one level lower than
the right sub-tree.
Operations on an AVL Tree:
➢ Insertion
➢ Deletion
➢ Searching
Left Rotation:
When a node is added into the right subtree of the right subtree, if the tree gets out of
balance, we do a single left rotation.
Right Rotation:
If a node is added to the left subtree of the left subtree, the AVL tree may get out of
balance, we do a single right rotation.
Left-Right Rotation:
A left-right rotation is a combination in which first left rotation takes place after that
right rotation executes.
Right-Left Rotation:
A right-left rotation is a combination in which first right rotation takes place after that
left rotation executes.