Starting from:
$30

$24

Homework 06 Solution




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.




n

o ha Le R ba a pe a







I addition, the Left-Right ( r Right-Left) case can ve a case in which the

ft-Right

( ight-Left) subtree is lanced. In this case, fter the double rotation is rformed, all balances re zero. This is

illustrated in Figures 9.72 through 9.74.







Book Student source code:

http://bcs.wiley.com/he-bcs/Books?action=resource&bcsId=5643&itemId=0470128704&reso urceId=21295







Note:

● Obey OOP principles and clean code standarts.

● Write a main and maintest classes for each question.

● Your submission is studentnumber.zip and include following files:

● o intelliJ project file

○ Q1 folder

○ Q2 folder

○ Q3 folder

● o Report.pdf

● o Javadoc

● The report must be in format “ReportFormat_hw6”

● For contact and questions “fesirci@gtu.edu.tr”

More products