Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 Introduction: In this project you will create a binary search tree. Description: Create a class called MysearchTree. MySearchTree will implement a binary search tree.

1

image text in transcribed

image text in transcribed

Introduction: In this project you will create a binary search tree. Description: Create a class called MysearchTree. MySearchTree will implement a binary search tree. MysearchTree will be a generic class storing a value of the generic type. It should have the following methods. The methods should all operate on the object making the call (none are static). All of the methods should use recursion (except for main) 10 points a) add Adds a node to the tree containing the passed value. 16 points b) find Returns true if the value passed is in the tree. 10 points c) leafCount Returns the count of all of the leaves in the tree 10 points d) parentCount Returns the count of all of the parents in the tree. 10 points e) height Returns the height of the tree. 10 points f) sPerfect Returns true if the tree is a perfect tree. A perfect tree is filled at every level). 10 points g) ancestors Returns the ancestor values of the passed value. 10 points h) inOrderPrint Prints node values using an inorder traversal. 10 points i) preorderPrint Prints node values using a preorder traversal. 10 points j) Main Demonstrates all of the above methods

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions