Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please code the following in java according to the specifications. You are to use Binary Trees to do this Program. Write a complete program, which

Please code the following in java according to the specifications.

You are to use Binary Trees to do this Program.

Write a complete program, which will process several sets of numbers:

For each set of numbers, you should:

  1. Create a binary tree.
  2. Print the trees using inorder, preorder, and postorder.
  3. Call a method Count which counts the number of nodes in each tree and then have the main program print the result.
  4. Create a binary tree from a combination of all the numbers from sets 1, 2, and 3 and then do the same thing for sets 4, 5, and 6.
  5. Print the 2 trees using inorder, preorder, and postorder.
  6. Call a method Count again which counts the number of nodes in the 2 trees with the main program printing the 2 totals.
  7. Then call a method (or 2 separate methods) which tells me how many even numbers and how many odd numbers there are in the 2 trees that were created in step 4 above. Once again, the main program should print the answers.

Data to be used

Use a value to determine end of data (example -999)

  1. Set #1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -999

  1. Set #2: 3 1 5 17 14 62 -999

  1. Set #3: 17 12 75 12 37 60 90 11 15 35 45 53 67 97 95 -999

  1. Set #4: 150 40 60 39 34 27 10 82 15 -999

  1. Set #5: 43 6 9 -999

  1. Set #6: 14 15 13 17 18 12 16 94 46 34 74 -999

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_2

Step: 3

blur-text-image_3

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

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

Consider this article:...

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago