Question: Use the step count method to estimate the time complexity of the binary search program? #include int find(int arr[], int 1, int r, int
Use the step count method to estimate the time complexity of the binary search program? #include int find(int arr[], int 1, int r, int x) " if (x >= 1) { int mid 1+ (1 - 1) / 2; if (arr[mid] == x) return mid; if (arr[mid] > x) return find (arr, 1, mid-1, x); return find (arr, mid + 1, r, x); return -1; 1 int main(void) f int arr[]{2, 3, 4, 10, 40 ); int n sizeof (arr) sizeof (arr[0]); int x 10; int result find (arr, 0, n1, x); (result =-1) ? printf("Element is not present in array") printf("Element is present at index d", result); return 0;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
