Summary of cases for insertion and determining what type of rotation(s) are needed: 

8/31/2004:

A) Some students asked me for a summary of cases for insertion and determining the need for and type of rotation(s) to correct imbalances in an AVL tree, so here you go...

 
Parent is critical (has a +2 or -2 balance factor); look at the child on the heavy side -
 
    Case 1) Child is heavy in the same direction as the parent.  A single rotation about the parent that is critical is all that it takes to correct the imbalance.   The rotation will be in the opposite direction of the heaviness.
 
    Case 2) Child is heavy in the opposite direction as the parent.  A double rotation is necessary.  First rotate about the child node in the direction opposite the heaviness of the child.  Now rotate about the critical parent in the direction opposite the heaviness of the parent.

B) For the flash animation that does tree traversals.  Your fellow student Tony Rubio sent me this website -  Thanks again, Tony!

http://nova.umuc.edu/~jarc/idsv/lesson1.html 

*************************************************************************************************