Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!