You are on page 1of 3

University of Central Florida

COP 3502 Computer Science I


Recitation 7
Due, Tuesday, August 4, 2015 up to 100
Wednesday, August 5, 2015 up to 90
Thursday, August 6, 2015 up to 80
Friday, August 7 2015 up to 70
Deliverables
To complete this assignment you must submit your file to Webcourses.
Introduction
The goal of this assignment is to practice AVL Tree rebalancing.
References
23_COP3502_AVLTrees1.pdf
24_COP3502_AVLTrees2.pdf
25_COP3502_AVLTrees3.pdf
Grading: 10 points per traversal (partial credit permitted).
(10 pts) Draw the resulting AVL tree after inserting the following items (in this order) into an initially
empty AVL tree: 86, 25, 98, 83, 27, 90, 71, 94. Show the tree after each step that requires a rebalance.
(There are 2 of these steps) Show the final tree after all items have been added.
After first rebalance
86
/

\
98

27
/
25

\
83

After second rebalance


86
/

27
/
25

\
83
/

94
/
\
90
98

2
71

3
(10 points) Draw the resulting AVL tree after inserting the following items (in this order) into an
initially empty AVL tree: 56, 17, 13, 88, 27, 67, 35, 20, 5, 28. Show the tree after each step that
requires a rebalance. (There are three of these steps.)
After first rebalance:
17
/
13

\
56

After second rebalance:


56
/
17

\
88
\
/
27 67

/
13
After third rebalance:

27
/
17
/
13
/
5

\
\

56
/
\
20 35
88
/
/
28
67

You might also like