Complete the AVL Tree class by providing the missing methods for removal. Demonstrate that these methods work. Review the changes required for methods decrementBa1ance, inc rementBa1ance, reba 1 anceleft, and reba 1anceRight discussed at the end of Section 9 .2. Also, modify reba1 anceleft (and reba1anceRight) 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.
In addition, the Left-Right (or Right-Left) case can have a case in which the Left-Right (Right-Left) subtree is balanced. In this case, after the double rotation is performed, all balances are zero. This is illustrated in Figures 9.72 through 9.74.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here