Question: 2. Given the following algorithm Input: left: array of n integers Input: right: array of n integens Input: : size of left and right 1
2. Given the following algorithm Input: left: array of n integers Input: right: array of n integens Input: : size of left and right 1 Algorithm: RecursionMystery 2 if n= 1 then if left[1] = right[1] then 4return lefI) s else return 0 7end s end o mid-In/2 o sum = RecursinMystery(left[l..mid, right[1.mid]) 11 8am=8um + RecursionMystery(leftImid+1..nl.rightlmid +1..n]) i2 for i = 1 to mid do 13 | for j = 1 to n-mid do if left[i] = right[mid+)] then end if right[i] = le mid+)] then I sum = sum + right end end end return summ a. Find a recurrence that describes the worst-case time complexity Name: b. Draw the recurrence tree and calculate its worst-case time complexity
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
