Complete the code to compare the target value with the current node's value.
if (target [1] node.value) { return search(node.left, target); }
In a BST, if the target is less than the current node's value, we search the left subtree.
Complete the code to return true if the target is found at the current node.
if (node.value [1] target) { return true; }
We return true when the current node's value equals the target.
Fix the error in the recursive call to search the right subtree.
if (target [1] node.value) { return search(node.right, target); }
If the target is greater than the current node's value, we search the right subtree.
Fill both blanks to complete the base case and recursive step for BST search.
if (node [1] null) { return false; } else if (target [2] node.value) { return search(node.left, target); }
The base case checks if the node is null (not found). If target is less than node value, search left.
Fill all three blanks to complete the BST search method with all cases.
if (node == null) { return false; } else if (target [1] node.value) { return search(node.left, target); } else if (target [2] node.value) { return search(node.right, target); } else if (node.value [3] target) { return true; }
If target is less, go left; if greater, go right; if equal, return true.
