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

What are the five major areas of chemistry
double w then divide v by the result
Is the group of words a clause or a phrase? That I like your tie
HELP PLEASE ASAP PLEASE HELP
Which of the following require the use of energy to move a molecule across a cell membrane
The sum of four consecutive numbers is 90. Find the numbers.
The product of two numbers is 20. If one the numbers is 5/12 what is the other number
Your principal has decided to provide a treat to everyone in your grade before thanksgiving break Ice - cream bars! one box contains 48 bars. there are 338 stud
On the map, which colony is the arrow pointing to? the chooses are A.Maryland B.Rhode Island C.North Carolina D.Georgia
Which statement best describes the doctrine of dual sovereignty? A. A person cannot be tried for the same crime twice B. A person cannot be tried for two crim