Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: Write a program which creates a binary search tree of different fruit from a file. The comparison is based on the fruits weight The

Objective:

Write a program which creates a binary search tree of different fruit from a file.

The comparison is based on the fruits weight

The file is tab delimited format goes as follows

o Fruit Type \t weight

The binary search tree needs to have the following methods

o insert: inserts a new fruit into the tree

o delete: deletes the fruit instance. Keep in mind that in order for a fruit to be equal it must have the same same type and weight.

o print pre-order traversal: Print the data. Next explore the left subtree. Finally right explore subtree.

o print in-order traversal: Explore the left subtree. Print the data. Finally explore the right subtree.

o print post-order traversal: Explore the left subtree. Then explore the right subtree. Finally print out the data.

Finally write a test file that demonstrates THE POWER OF TREES!!! FRUIT!!! By reading a shape file.

HINTS:

Creating a class for fruit makes this problem so much easier

Having a toString, compareTo, and an equals method would really be useful

Recursion is your friend.

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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

Give two noncomputer examples of the concept of cache.

Answered: 1 week ago

Question

Q.1. Taxonomic classification of peafowl, Tiger and cow ?

Answered: 1 week ago

Question

Q .1. Different ways of testing the present adulterants ?

Answered: 1 week ago

Question

Q.1. Health issues caused by adulteration data ?

Answered: 1 week ago