Question: Consider that we have a binary search tree that holds employee salaries. Each node in the tree will hold the name and salary of
Consider that we have a binary search tree that holds employee salaries. Each node in the tree will hold the name and salary of an employee. a. Write the code for class TreeNode b. Write a modified version of the findorinsert method to insert employees in the binary search tree according to their salaries. c. Write a recursive method public void print(TreeNode n) (part of the BST class) to print the employee names and salaries sorted in ascending order according to their salaries. d. Write a main method that will create an empty binary search tree and fill it with 4 employees of your choice and then print the names and salaries of all employees sorted in ascending order Note: to help you with this question, you can use the code for BST attached to this assignment.
Step by Step Solution
3.30 Rating (153 Votes )
There are 3 Steps involved in it
code for the TreeNode class modified findOrInsert method recursive print method and a main method th... View full answer
Get step-by-step solutions from verified subject matter experts
