INSERT THE TITLE OF YOUR PRESENTATION HERE Nawazish Ali Ali Abbas Noor Talha Ijaz
INSERT THE TITLE OF YOUR PRESENTATION HERE AVL TREE
What is AVL TREE The AVL check the height of left and right sub-trees and assume that the difference is not more than 1. Difference mean (Balance factor = Height (left sub-trees) --- Height (right sub-trees) ) AVL is an example of : Balanced Binary Search Trees Def.
Introduced When and who was introduced: Named after 2 Russian mathematicians Georgii Adelson-Velsky ( ?) Evgenii Mikhailovich Landis ( ) Who published it 1962 in their paper: “An Algorithms for the organization of information”
Advantages of Binary Search Tree Use AVL to keep balance in a tree. Search things with efficient way. If Balanced it is called AVL TREE. A Non empty binary tree is also called AVL TREE
Balance factor: Height of left sub tree –Height of right sub tree Range of Balance factor is between (1,0,-1) Every node balance factor is between this range is called AVL TREE. We need to check only ancestors balance factors of a inserted node.
Example: L0 L1 L =0
Example: =-2 According to this It’s not AVL tree But we convert it i n AVL tree to some rules
Rotation: 1:AVL TREE use rotations to maintain balance. 2:Look the nearest ancestor of the inserted node, whose balance factor is disturb.
Types of Rotations: 1: LL Rotation 2: RR Rotation 3:RL Rotation 4:LR Rotation
LL Rotation: Used when node is inserted into right sub-tree of right sub-tree. 0 A B C C B C C A Insert new node Balance (0) L-L
Right Rotation: Node is inserted in the left of left sub-tree. 0 C C B A A C C B Balance (0) R-R
Left – Right Rotation: Node is inserted in the right of left sub-tree and make the tree unbalanced. 0 C C B A C C B A L-R BA C C R-R Binary tree
Right-Left Rotation: Node is inserted into left of right sub-tree. 0 A B C C A C C B C C BA L-R R-R
Any Questions………………..???