![]() |
Introduction to Computer Science II Homework 8 |
Assigned: Friday, Oct 31, 2014 Due: Monday, Nov 10, 2014, at 3pm. |
Homework 8Part I: Implement an AVL TreeImplement single and double rotations and make sure that during insertions and deletions your tree maintains the AVL property. I recommend writing a check_ballance() method that ensures your tree is balanced and using this for testing. For full credit insertion and deletion must be logarithmic time. This means you have to compute the height of a node in constant time. I recommend writing the tree first using an expensive, recursive height() method and, once its working, developing another mechanism for computing the height.I recommend starting from your vanilla binary search tree from last week and adding balancing routines. Part II: Timing resultsCompare your AVL tree to last weeks binary search tree. Which is faster? How much faster? Can you come up with an input on which the vanilla tree is faster?Part III: Written Homework
|