Question
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/
1 | Noah | Emma |
2 | Liam | Olivia |
3 | Mason | Sophia |
4 | Jacob | Ava |
5 | William | Isabella |
6 | Ethan | Mia |
7 | James | Abigail |
8 | Alexander | Emily |
9 | Michael | Charlotte |
10 | Benjamin | Harper |
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