Complete the code to calculate the middle index in the recursive binary search.
int mid = low + ([1] - low) / 2;
The middle index is calculated using the high and low indices to avoid overflow.
Complete the code to check if the middle element is the target in recursive binary search.
if (arr[mid] == [1]) { return mid; }
We compare the middle element with the target value to find if we found the element.
Fix the error in the recursive call to search the left half when target is smaller than middle element.
return binarySearch(arr, low, [1], target);
When target is smaller, search the left half by setting high to mid - 1.
Fill both blanks to search the right half when target is greater than middle element.
return binarySearch(arr, [1], [2], target);
To search the right half, set low to mid + 1 and keep high unchanged.
Fill all three blanks to complete the base case that stops recursion when element is not found.
if ([1] > [2]) { return [3]; }
The recursion stops when low is greater than high, meaning the target is not in the array, so return -1.
