Question
binary search tree - java, plz use simple java language, netbeans 8.1 or 8.2 PLZ do the main method too THANK U Create a new
binary search tree - java, plz use simple java language, netbeans 8.1 or 8.2
PLZ do the main method too
THANK U
Create a new Java Application that has the following methods:
1. A method that generate a binary search tree (BST) where the number of nodes and the range of the values are
from a file.
2. A recursive method to print the BST in preorder traversal
3. A recursive method to print the BST in post-order traversal
4. A recursive method to print the BST in in-order traversal
5. A recursive method to count the number of all nodes in BST
6. A recursive method to find the largest value in a BST
7. A method to find and return the smallest value in a BST.
8. A method to search for a given value V in a BST.
9. A method to count the number of ancestors of a given value V
10. A method to count the number of comparisons to decide whether a given value V is in a BST.
11. A method to count the number of leaf nodes in BST
12. A method to count how many nodes containing a given value V
13. A method to count the number of nodes that contain even numbers in a BST
14. A method to count the number of nodes with 2 children (child may be a single node or a sub-tree)
15. A method to print a BST sorted in reverse order
16. A method to print a BST in breadth first order
17. A method reconstruct a BST given its preorder traversal
18. A method to check if two BSTs are identical
19. A method mirror() to create a mirror image of BST
20. A method to check if a BST T1 is a mirror of T2
21. A method to find the common elements between two BSTs, and insert them in 3rd BST
Write the main method to test these methods described in 1 to 19
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