Answered step by step
Verified Expert Solution
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:
- Create a binary tree.
- Print the trees using inorder, preorder, and postorder.
- Call a method Count which counts the number of nodes in each tree and then have the main program print the result.
- 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.
- Print the 2 trees using inorder, preorder, and postorder.
- Call a method Count again which counts the number of nodes in the 2 trees with the main program printing the 2 totals.
- 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)
- Set #1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -999
- Set #2: 3 1 5 17 14 62 -999
- Set #3: 17 12 75 12 37 60 90 11 15 35 45 53 67 97 95 -999
- Set #4: 150 40 60 39 34 27 10 82 15 -999
- Set #5: 43 6 9 -999
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started