Diamond6748 Diamond6748
  • 15-12-2022
  • Computers and Technology
contestada

Given this function, what is the big O time complexity?
int search(int arr[], int l, int r, int num) {
if (l <= r) {
int mid = (l + r)/2;
if (arr[mid] == num)
return mid ;
if (arr[mid] > num)
return search(arr, l, mid-1, num);
if (arr[mid] < num)
return search(arr, mid+1, r, num);
}
return -1;
}
a.
O(n2)
b.
O(1)
c.
O(logn)
d.
O(n)

Respuesta :

Otras preguntas

The ratio of Alex’s toy cars to Jim’s toy cars is 8:3. How many toy cars do they have altogether, if Alex has 40 more cars than Jim.
A chemist needs 90 milliliters of a 72% solution but has only 68% and 77% solutions available. Find how many milliliters of the 68% solution should be mixed wit
Select true or false: if the ph of pure water is 7.0, the hydroxide ion concentration in pure water is 1 × 10–7 m.
what is -3×^2+1467x-86940=0 ?​
5x(2) Explain to me please Thanks
5^12 ÷ 5^4 = _____ A) 5^3 B)5^8 C) 5^16
What is the value of x?
Gloria loves to pick flowers. Fragment or sentence
A baby is admitted to the hospital with a history of projectile vomiting after each feeding. On examination, it is found that the sphincter controlling food pas
The main way a recessive allele would be expressed even when only one copy is present would be ________.