CPS 100E, Fall 1996 Inlab 10


Name:

Lab Section:


You should answer the following questions and either turn in the sheet during lab, or answer the questions when you submit your README file. These questions are worth 2 out of the 10 points for each lab. You don't need to get all the answers right to get the 2 points, but you must try.

It's ok to ask a UTA or TA for help, but first you must try to find the answers on your own.

  1. What is the maximum number of rotations that are done when you insert one node into an AVL tree?



  2. What is the fewest number of nodes that an AVL tree with height (by edges) 2 have? 3? 4? n?



  3. How many (quantity) of each type of rotation occur when the file test.dat is read into usetree



  4. If we do the following operations on the binary tree:
    • Read the file test.dat
    • Delete cow
    • Delete dog
    • Delete bee
    • Add hamster
    • Delete monkey

    What word would be at the root of the tree?



  5. When the member functionl GetSuccessor(node) of the TreeList class returns 0, the inorder succesor of node (the word that comes after node->info in alphabetical order) is not in node's right subtree. Describe where node's inorder successor is in the tree if it exists.