Question: Please help me implement the two search functions for BinarySearchTree.java public class BinarySearchTree { TreeNode root; /** * constructor create a empty binary search tree

Please help me implement the two search functions for BinarySearchTree.java

public class BinarySearchTree> { TreeNode root; /** * constructor create a empty binary search tree by setting root to be null */ public BinarySearchTree(){ root = null; } /** * Search the given data in this binary search tree * If the data is found, return a reference to the tree node * Otherwise, return null * @param data The target to search * @return a TreeNode reference to the node that contains the data * if no node contains data, return null */ public TreeNode search(E data){ } /** * Insert given node to this binary search tree. If this tree * is empty, the given node becomes the root of this tree. * @param newNode the given node to be inserted */ public void insert(TreeNode newNode){ }

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!