Docsity

AVL Tree Example: Verification and Manipulation, Exercises of Advanced Algorithms

Toggle sidebar
bg1
An AVL tree example
Consider the tree Tgiven below.
1. Verify that Tis an AVL tree (i.e. that it satisfies the so-called height
balance property).
2. For each of the sequences of inputs below, begin with the tree Tand insert
the items in the order given. Show each tree after you insert an item. Each
of these intermediate trees should also be AVL trees.
For each sequence, start over again with the original tree T.
(a) 15,12,50,49
(b) 15,50,29,12
(c) 12,15,20,60
(d) 60,12,20,15
3. Do the same as above, but instead delete the vertices as shown in the order
given. Again, any intermediate trees should also be AVL trees.
(a) 10
(b) 27,41
1
docsity.com

Partial preview of the text

Download AVL Tree Example: Verification and Manipulation and more Exercises Advanced Algorithms in PDF only on Docsity!

An AVL tree example Consider the tree T given below.

  1. Verify that T is an AVL tree (i.e. that it satisfies the so-called height balance property).
  2. For each of the sequences of inputs below, begin with the tree T and insert the items in the order given. Show each tree after you insert an item. Each of these intermediate trees should also be AVL trees. For each sequence, start over again with the original tree T. (a) 15, 12 , 50 , 49 (b) 15, 50 , 29 , 12 (c) 12, 15 , 20 , 60 (d) 60, 12 , 20 , 15
  3. Do the same as above, but instead delete the vertices as shown in the order given. Again, any intermediate trees should also be AVL trees. (a) 10 (b) 27, 41

docsity.com