Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in JAVA please! Q 1 - Coding Question In this question you ll be making a binary tree to store test scores Write a

Code in JAVA please!
Q1- Coding Question
In this question youll be making a binary tree to store test scores
Write a node class that will be used in a binary search tree the node class will contain
A reference to its left and right children
Students name as a String
Students test score as an int
Methods to get the left and right children
Methods to get the students name and score
A method to tell whether this is a leaf node or not
A method to get the height of the node (how many children until the leaf node
starting at this node)
Write a class for the binary tree with the following:
A root node
A no arg constructor
A constructor that can take a root node, and its left and right binary tree
children and makes that the binary tree
A method to add a node to the tree
When adding nodes to the tree, you will have to decide on whether to put
them to the left or right, a good way to do this is whether the current
nodes value is less than or greater than the node being addeds value
A method to get the total height of the tree
A method to get the number of nodes in the tree
Write a test class and add some students into your binary tree
Q2- Discussion Question
What kind of traversal would we do if we wanted to get our test scores in order from smallest to
largest? Would it be the same for largest to smallest (how would it be different)?(You can base
it on how you built your trees add method)

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

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

=+What is the big message you want them to know?

Answered: 1 week ago

Question

Knowledge of process documentation (process flow charting)

Answered: 1 week ago