Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA DATA STRUCTURES Im creating a binary search tree class that takes two strings as parameters and then outputs data related to the parameters The

JAVA DATA STRUCTURES

Im creating a binary search tree class that takes two strings as parameters and then outputs data related to the parameters The point of the program is to take the common name of an animal, and then translate it to its genus scientific name.

example:

bst.translate("dog");

should output "Canis"

bst.translate("cat");

should output "Felis"

if no match is found in the binary search tree, then simply output the user input as is.

example:

bst.translate("hippo")l

should output "hippo" + a relevant message if no match is found.

1)

A method:

Public void insert(String commonName, String genusName) -The BST should use the common name to order the tree: a name should go to the left if it is alphabetically before the current nodes name and to the right if it is after this nodes name; duplicate names are ignored) -

2)

A method:

public void Translate(String commonName)

to get a translation: this method should take a String (commonName) and search for it recursively. If the name is not found, return null. if the commonName is found, return its genusName.

MOCK DATA:

commonName: GenusName:

dog canis

cat felis

horse equus

lion panthera

cat felis

we can assume all names are lowercase for the program.

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2022 Grenoble France September 19 23 2022 Proceedings Part 4 Lnai 13716

Authors: Massih-Reza Amini ,Stephane Canu ,Asja Fischer ,Tias Guns ,Petra Kralj Novak ,Grigorios Tsoumakas

1st Edition

3031264118, 978-3031264115

More Books

Students also viewed these Databases questions

Question

discuss the uses of imagery;

Answered: 1 week ago