Complete the code to sort the array using bubble sort.
for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - i - 1; j++) { if (arr[j] [1] arr[j + 1]) { int temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } }
The bubble sort swaps elements if the current element is greater than the next, to sort in ascending order.
Complete the code to find the middle index for merge sort splitting.
int mid = [1] + (high - low) / 2;
The middle index is calculated from the low index plus half the distance to high.
Fix the error in the binary search condition to find the target.
if (arr[mid] [1] target) { return mid; } else if (arr[mid] < target) { low = mid + 1; } else { high = mid - 1; }
Binary search finds the target when the middle element equals the target.
Fill both blanks to complete the insertion sort inner loop condition.
while (j >= 0 && arr[j] [1] key) { arr[j + 1] = arr[j]; j [2]; }
Insertion sort shifts elements greater than the key to the right and decrements j.
Fill all three blanks to complete the filtering loop that filters and transforms data.
for (int i = 0; i < n; i++) { if (arr[i] [1] pivot) { result[[2]] = arr[i] * 2; } [3] }
The loop filters elements less than pivot, stores doubled values using index i in result, and continues to the next iteration.
