Question: Program a binary search tree ( BST ) in Java by implementing the interface given below. public interface BinaryTree < E extends Comparable
Program a binary search tree BST in Java by implementing the interface given below.
public interface BinaryTree E extends Comparable
public void insert E item; inserts an E item to the BST
public void delete E item; deletes the E item
public boolean findE item; returns true if E item exist, else return false
public int treeHeight : returns the height of the BST
public int itemHeight E item; returns the height of the E item, else return
public int leftHeight E item; returns the height of the left subtree of E item
public int rightHeight E item:returns the height of the right subtree of E item
public boolean isleaf E item; returns true if E item is a leaf node else false
public int status E item; retun if root, if left child, if right child
public void display ; prints out the contents of the BST in descending order
The BST must have the following properties: for any unique value x and y either x is less than y or y is less than x; and for any node in the BST the key stored is greater than any key in its left subtree and less than any key in its right subtree. For the delete method, use the successor to for case For both the leftHeight and rightHeight method, an emptynull subtree has a height of
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
