Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In Java: In Java: -binary-search-tree-task *Create a class called MySearchTree. -It will implement a binary search tree. -It will be a generic class storing a
In Java:
In Java: -binary-search-tree-task *Create a class called MySearchTree. -It will implement a binary search tree. -It will be a generic class storing a value of the generic type. The following methods will be implemented: *The methods should all operate on the object making the call (none are static) * *All of the methods should use recursion (except for main) * add Adds a node to the tree containing the passed value. find Returns true if the value passed is in the tree. leafCount Returns the count of all of the leaves in the tree. parentCount Returns the count of all of the parents in the tree. height Returns the height of the tree. isPerfect Returns true if the tree is a perfect tree. (A perfect tree is filled at every level). ancestors Returns the ancestor values of the passed value inOrderPrint Prints node values using an inorder traversal. preOrderPrint Prints node values using a preorder traversalStep 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