Complete the code to calculate the middle index in the recursive binary search.
let mid = (low + [1]) / 2;
The middle index is found by averaging the low and high indices.
Complete the code to check if the middle element is equal to the target value.
if arr[mid] [1] target {
We check if the middle element matches the target to find it.
Fix the error in the recursive call when the target is less than the middle element.
return binary_search(arr, low, [1], target);
If the target is less than the middle element, search the left half by setting high to mid - 1.
Fill both blanks to correctly handle the recursive call when the target is greater than the middle element.
return binary_search(arr, [1], [2], target);
When the target is greater, search the right half by setting low to mid + 1 and keeping high the same.
Fill all three blanks to complete the base case that stops recursion when the target is not found.
if [1] > [2] { return [3]; }
The search ends when low is greater than high, meaning the target is not in the array, so return -1.
