AVL Rotations

Rotation is required only in the nodes which are imbalance, imbalance means that | height of right sub-tree - height of left sub-tree | > 1. Balancing reduce the height of tree like a tree with node n have maximum height (n-1) but after rotation it will be about log(n).

 There are generally 4-types of rotation in AVL tree ->

  1. LL Rotation
  2. RR Rotation
  3. LR Rotation
  4. RL Rotation
            Naming of rotation here used on the basis of insertion position (can be named anything). Like in LL rotation the inserted element is as position Given_Node->left->left, in RL rotation the inserted element is at location Given_Node->right->left. During insertion only a single get unbalanced and after balancing that node the whole tree get balanced again.

If we consider a<b<c, then -> 








Comments

Popular posts from this blog

Insertion/Deletion in 2-3 Tree