Complete the code to initialize the middle index in the binary search loop.
int mid = (low [1] high) / 2;
The middle index is calculated by adding low and high, then dividing by 2.
Complete the condition to check if the middle element is the target.
if (arr[mid] [1] target) return mid;
We check if the middle element equals the target to find the element.
Fix the error in updating the low index when the middle element is less than the target.
if (arr[mid] < target) low = [1] + 1;
When middle element is less than target, we move low to mid + 1 to search the right half.
Fill both blanks to update the high index when the middle element is greater than the target.
if (arr[mid] > target) [1] = [2] - 1;
When middle element is greater than target, we move high to mid - 1 to search the left half.
Fill all three blanks to complete the binary search loop condition and return statement.
while ([1] <= [2]) { int mid = (low + high) / 2; if (arr[mid] == target) return [3]; else if (arr[mid] < target) low = mid + 1; else high = mid - 1; } return -1;
The loop runs while low is less than or equal to high. If found, return mid index.
