Homework 06
Q1:Create and plot the worst RedBlack Tree with height of 6.
Q2: Code the binarySearch method of the BTree.
Q3: Complete the AVL Tree class by adding a new constructor that takes a binary tree and checks whether this tree is AVL tree or not. Complete the AVL Tree class by providing the missing methods for removal. Demonstrate that these methods work. Review the changes required for methods decrementBalance, incrementBalance, rebalanceleft, and rebalanceRight discussed at the end of Section 9 .2. Also, modify rebalanceleft (and rebalanceRight) to consider the cases where the left (right) subtree is balanced. This case can result when there is a removal from the right (left) subtree that causes the critical imbalance to occur. This is still a Left-Left (RightRight) case, but after the rotation the overall balances are not zero. This is illustrated in Figures 9.70 and 9.71 where an item is removed from subtree c.
Reviews
There are no reviews yet.