Question: Q1. [40 Points] Multiple Choice and True/False Questions 1. [15] Trace the following code and write the output and also mention what the code does.

 Q1. [40 Points] Multiple Choice and True/False Questions 1. [15] Trace

Q1. [40 Points] Multiple Choice and True/False Questions 1. [15] Trace the following code and write the output and also mention what the code does. int algorithm(int arr[], int I, int r, int x) { if (r >= 1) { int mid = 1 + (r-1)/2 if (arr[mid] == x) return mid if (arr[mid] > x) return algorithm(arr, I, mid-1, x) return algorithm(arr, mid + 1, r, x) } return -1 } int main(void) { int arr[] = { 2, 3, 4, 10, 40, 7, 9, 11} int n = sizeof(arr) / sizeof(arr[0]) int x = 11 int output = algorithm(arr, 0, n-2, x) (output == -1) ? printf(" 11 is not found in the list") : printf("11 is found at index %d", output) return 0 2. [5] Why does divide and conquer strategy support parallelism? 3. [10] Given the following 6 trees a to f

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!