Question: b. Draw the recurrence tree and calculate its worst-case time complexity. 2. Given the following algorithm Input: left: array of n integers Input: right: array

b. Draw the recurrence tree and calculate its worst-case time complexity.
2. Given the following algorithm Input: left: array of n integers Input: right: array of n integers Input: n: size of left and right 1 Algorithm: RecursionMystery 2 if n = 1 then 3 | if left[1] = right[1] then return left] 5else 6 7 8 end return 0 end 9 mid= In/2] 10 sum = RecursionMystery (left[1..midl. right [1..mid ) 11 sun = sum + RecursionMystery(leftmid +1..n].rightmid +1..) 12 for i = 1 to mid do 13 | for j = 1 to n-mid do 14 15 16 17 18 19 if left[i] = right[mid+j] then sunn = surn + left[i] end if right[i] = left[mid+3] then sum = sum + right[i] end end 1 end 22 return sum a. Find a recurrence that describes the 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
