CSD201_-_FA_2024_-_FE_-_C1_2980.webp
T

CSD201_-_FA_2024_-_FE_-_C1_2980.webp

  • Media owner Thu Hà1
  • Ngày thêm
(Choose 1 answer)
Consider the binarySearch() function below:
int binarySearch(int[] a, int x, int low, int high)
{ int t, k;if(low > high) return(-1);if(x<a[k]) return (binarySearch(a,x,low,k-1);
k = (low + high) / 2;
if(a[k] == x) return(k);
else return(binarySearch(a,x,k+1,high);
}
int[] a = {2,4,6,8,10,12,14, 16);
Suppose the array a is given by the statement:For the call binarySearch(a,7,2, 5), how many calls to this will be made, including the original call?
A. 3
B. 2
C. 4
D. 5

18

Thông tin

Category
CSD201
Thêm bởi
Thu Hà1
Ngày thêm
Lượt xem
7,388
Lượt bình luận
29
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
CSD201_-_FA_2024_-_FE_-_C1_2980.webp
File size
211.5 KB
Dimensions
1920px x 1012px

Share this media

Back
Bên trên Bottom