Question: Here is BST code: public class BST{ BSTNode root; //Constructor public BST(){ root=null; } //Method to serach a key public boolean search(int k){ BSTNode cur=null;

Here is BST code:
public class BST{ BSTNode root; //Constructor public BST(){ root=null; } //Method to serach a key public boolean search(int k){ BSTNode cur=null; while(cur!=null){ if(cur.key==k) return true; else if(k -------------------------- public class BSTNode{ int key; BSTNode left; BSTNode right; //Constructor public BSTNode(int k){ key=k; left=null; right=null; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
