Implement a AVL Search Tree. The AVL Search Tree should be in its own file, with
ID: 3719841 • Letter: I
Question
Implement a AVL Search Tree. The AVL Search Tree should be in its own file, with all related classes internal to the AVL class as private classes. The AVL Search Tree needs to be able to contain comparable items. You can do this using generics. The AVL Tree must contain the following methods boolean contains(Key k) - returns true if k is in the AVL. false if not. void insert(Key k) - inserts k into the AVL in the appropriate spot. boolean delete(Key k) - removes k from the AVL if it exists, returns false if it is not in the tree. inorder() - Prints a well formatted in order visit of every node in the AVL. preorder() - Prints a well formatted pre order visit of every node in the AVL. postorder() - Prints a well formatted post order visit of every node in the AVL.
implement a toString method which will print the following:
Level #:List of nodes in the level
Example: AVL tree looks like
0
1 2
Level 0 - 0
Level 1 - 1, 2
*Use Java for the code*
Explanation / Answer
The code is well commented so it shouldn't be a problem understand anything ask doubts in the comments section.
CODE
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.