Please the answer have to be in JAVA programing language Problem 1: Write a clas
ID: 3714398 • Letter: P
Question
Please the answer have to be in JAVA programing language
Problem 1: Write a class that implements a generic binary search tree including the methods add, contains and printInorder. (We will do this as a group)
Problem 2: Add a toString method to the class. This method returns a string of the form “[e1, e2, …, en]” containing all of the elements in the tree in order.
Problem 3: Add a method to the class that returns the number of leaves in the tree.
Problem 4: Add a clone method to the class that returns a copy of the tree. Be careful how you travel through the tree. You don’t want to do this in-order or the clone tree will be very lopsided.
Problem 5: Add an equals method to the class. Two trees are equal if they include the same elements. The structure of the trees does not have to be the same.
Explanation / Answer
Solution
Feel free to reach out regarding any queries . Thank you .