Question: For the following function derive the recurrence relation for the execution time including the base case. Assume that j -i +1 is a power of

For the following function derive the recurrence relation for the execution time including the base case. Assume that j -i +1 is a power of 2. Presume that the time is determined by the number of comparisons that are made. f(ij) Ilij are the indices of the underlying array A. { if (i == j-1) return maximum(A[i], A[i+1]); else { m = f(i,(i+1)/2); m2 = f((i+1)/2+1, 1); return maximum (m1,m2); } } // maximum (x,y) compares x and y and returns the maximum element among them. It executes one comparison T(1)=1. T(n) = 2T/2) + n T(1)=1. T(n) = 2Tn/2) + 1 T(1)=1. T(n) = Tn/2] +1 T(1)=1. T(n) = Tn/2) + Tn) None of the above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
