You will perform a series of graphical hand executions on an AVL tree. You will

WRITE MY ESSAY

You will perform a series of graphical hand executions on an AVL tree. You will also implement
rotations on 2 small “hard coded” trees and verify correctness via traversal.
PART 0
Create drawings to manually insert the following sequence into an AVL tree:
60,35,80,55,30,25,10,75,50,15,40,95,20,45,90,85,70,65
1) Show the tree before and after each insertion.
2) Show the tree before and after each rotation.
3) Indicate the pivot node before each insertion.
4) Indicate the balance factors before and after updating them (cross out the old bf, and
write down the new bf).
5) Indicate the nodes involved in each rotation.
6) Indicate the subtrees before and after each rotation.
PART 1
The following simple trees are out of balance and in need of rotations. See the posted files
“AVL_LL.cpp” and “AVL_LR.cpp” which contain very small “hard coded” AVL trees in need of
rotation. Modify theses files to perform the rotations by changing the pointer values
appropriately. After the rotations, output the preorder, inorder and postorder sequences for
each tree traversal.
Tree 1 Tree

WRITE MY ESSAY

Leave a Comment

Scroll to Top