Complete the code to correctly calculate the midpoint for dividing the array.
int mid = (low [1] high) / 2;
The midpoint is calculated by adding low and high, then dividing by 2.
Complete the code to correctly express the recurrence relation for merge sort.
T(n) = 2T([1]) + cn
Merge sort divides the problem into two halves of size n/2 each.
Fix the error in the recurrence relation for binary search.
T(n) = T([1]) + cBinary search reduces the problem size by half each time, so the recurrence is T(n) = T(n/2) + c.
Fill both blanks to complete the recurrence relation and its base case for quicksort.
T(n) = T([1]) + T([2]) + cn
Quicksort divides the array into two parts: one of size k and the other of size n-k-1.
Fill all three blanks to complete the recurrence relation and the condition for the base case in a divide and conquer algorithm.
if (n [1] 1) return c;\nT(n) = aT(n [2] b) + f(n) where [3] is the division factor
The base case is when n is less than or equal to 1. The recurrence divides n by b, where b is the division factor.
