Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement a Binary Search Tree to serve as a decision tree. The purpose of this decision tree is just to say yes or no the

Implement a Binary Search Tree to serve as a decision tree. The purpose of this decision tree is just to say yes or no the node exists in the tree and prints out the node data. In your node class, you will have String sData; // represents name int iData; // represents place on top ten list Node left; // left child (left subtree) Node right; // right child (right subtree) Implement the necessary methods, including insert and search. NOTE: To compare strings, look at compareTo() method.

In your driver Make a tree, named boysNameTree.

Insert each boy name into the tree.

Search for the names in the list, when found print their name (sData) and placement (iData) on the top ten list.

Search a name not listed and your name.

Create a new tree girlsNameTree.

Insert each girl name into the tree. Search for the names in the list, when found print their name (sData) and placement (iData) on the top ten list.

Search a name not listed and your name.

Print the results of each method call.

Listed below are the top 10 names in the US according to https://www.ssa.gov/oact/babynames/

1NoahEmma
2LiamOlivia
3MasonSophia
4JacobAva
5WilliamIsabella
6EthanMia
7JamesAbigail
8AlexanderEmily
9MichaelCharlotte
10BenjaminHarper

Step by Step Solution

3.40 Rating (147 Votes )

There are 3 Steps involved in it

Step: 1

public class TreeDriver public static void mainString argsTree boysNameTree new TreeTree girlsNameTree new Tree boysNameTreeinsert1 NoahboysNameTreein... 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

Recommended Textbook for

Microeconomics and Behavior

Authors: Robert Frank

9th edition

9780077723750, 78021693, 77723759, 978-0078021695

More Books

Students also viewed these Programming questions

Question

What is the Easterlin Paradox?

Answered: 1 week ago