Objective:
Practice doing rotations with balanced BSTs
AVL rotations
References: if you need help in the way AVL rotations work,
any of the following references should help you. A couple
of them are applets that will build the AVL tree for you.
Build these AVL trees using single rotations. You should
add the values to a BST in the order given, then when the tree becomes
out of balance, balance it. Be sure
that the tree is balanced each time before you do an insertion.
1, 2, 3, 4, 5, 6, 7
8, 5, 12, 3, 2, 1
Build these trees using double rotations
30, 20, 40, 35, 37
82, 75, 98, 60, 79, 80
Build these trees using whatever rotations are necessary
4, 2, 6, 1, 3, 5, 7, 16, 15, 14, 13, 12, 8, 10
48, 76, 27, 52, 87, 50, 51, 92, 49, 52
Hand in:
Hand in your diagrams of trees, showing the rotations, reasonably neat.
It is expected that every diagram will be correct, since you can check it
with the applets. Just be aware you will not have the applets
available on an exam :-)(You have two
hours to do this, so don't get too impatient)