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
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*
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started