next up previous
Next: 5.2 Red-Black Trees Up: 5.1 AVL Trees Previous: 5.1.1 Maximum Height of an AVL Tree

5.1.2 AVL Trees: Insertions and Deletions

Rotation in a BST


  
Figure 5.5: Insertion in AVL trees: Scenario D
\begin{figure}
\centerline{\psfig{figure=figures/Favlins1.ps,height=7in}}
\end{figure}


  
Figure 5.6: Insertion in AVL trees: Scenario C
\begin{figure}\centerline{\psfig{figure=figures/Favlins2.ps,height=4in}}
\end{figure}


  
Figure 5.7: Deletion in AVL trees: Scenario 1
\begin{figure}\centerline{\psfig{figure=figures/Favldel1.ps,height=3in}}
\end{figure}


  
Figure 5.8: Deletion in AVL trees: Scenario 2
\begin{figure}\centerline{\psfig{figure=figures/Favldel2.ps,height=3in}}
\end{figure}

Insertion: Problem Scenario 1: (Scenario D)

Scenario A is symmetrical to the above. See Figure 5.5.

Insertion: Problem Scenario 2: (Scenario C)

Scenario B is symmetrical to this. See Figure 5.6.

Deletion: Problem Scenario 1:

Depending on the original height of T2, the height of the tree will be either unchanged (height of T2 = h) or gets reduced (if height of T2 = h - 1). See Figure 5.7.
There is a scenario symmetric to this.

Deletion: Problem Scenario 2:

See Figure 5.8. As usual, there is a symmetric scenario.


next up previous
Next: 5.2 Red-Black Trees Up: 5.1 AVL Trees Previous: 5.1.1 Maximum Height of an AVL Tree
eEL,CSA_Dept,IISc,Bangalore