Question: Java coding Problem 1: (Points 12) In this problem, you will write some Java code for simple operations on binary search trees where keys are


Java coding
Problem 1: (Points 12) In this problem, you will write some Java code for simple operations on binary search trees where keys are ints. Assume you already have the following code. Assume the method bodies, even though not shown, are correct and implement the operations as we defined them in class. public class Binary Search TreeNode { public int key; public SomeType value; public Binary Search TreeNode left; public Binary Search TreeNode right; public class BinarySearch Tree { private Binary Search TreeNode root; public void insert(int key, Some Type value) {...} public void delete(int key) {...} public Some Type find(int key) {...} Don't overlook part (c). (a) Add a method public int treeHeight() to the Binary Search Tree class that computes the height of the tree. You will need a helper method. (b) Add method public void delete Max() to the BinarySearchTree class that deletes the maximum element in the tree (or does nothing if the tree has no elements). You may want a helper method. (c) Add method public void delete Min() to the Binary Search Tree class that deletes the minimum element in the tree (or does nothing if the tree has no elements). You may want a helper method. (d) For your answers in part (a), (b) and part (C), give a worst-case big-Oh running time in terms of n, where n is the number of nodes in the tree. Do not assume the tree is balanced
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
