AVL
What is AVL?
AVL is a self balancing tree where the height difference between left and right is less than 2 nodes.AVL useful for make searching more effectively.Important things that you might know:
-Node Height:- empty subtree = 0
- leaf = 1
- maximum height of children internal node + 1
- maximum balance factor = 1
There are violation in number 17 because the difference between left and right is 2.
So,we need to rebalance it...But how?
How to rebalance Binary tree?
- Single rotation
- Double rotation
What is Single Rotation?
What is Double Rotation?
Double rotation happens when the insertion is in the inner branch,so to make it balance you must apply double rotation.
Here it's how to apply double rotation:
