Question: What does the following program do? Whats its time complexity? Justify. int myFun(A[0..N-1], value, low, high) { if (high < low) return -1; mid =
What does the following program do? Whats its time complexity? Justify.
int myFun(A[0..N-1], value, low, high) { if (high < low) return -1; mid = low + ((high - low) / 2); if (A[mid] > value) return myFun(A, value, low, mid-1); else if (A[mid] < value) return myFun(A, value, mid+1, high); else return mid; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
