Question: Compute the recurrence for the worst case time complexity and draw the recursion tree for the recursivea lgorithm below: Input: A: array of n objects

 Compute the recurrence for the worst case time complexity and draw

Compute the recurrence for the worst case time complexity and draw the recursion tree for the recursivea lgorithm below: Input: A: array of n objects Input: B: array of n objects Input: n: number of elements in A and B Output: minimum distance between two points in A and B according to function dist 1 Algorithm: MinDist 2 if n = 1 then 3 return dist(A[1], B[1]); 4 else 5 mid = (n/2]; 6 A1 = A[1..mid]; 7 A2 = A[mid + 1..n]; B1 = B(1..mid); B2 = B[mid + 1..n]; 10 d11 = MinDist(A1, B1); d12 = MinDist(A1, B2); d21 = MinDist(A2, B1); 022 = MinDist(A2, B2); return min{d11, d12, d21, d22}; 15 end 8 11 12 13 14 Compute the recurrence for the worst case time complexity and draw the recursion tree for the recursivea lgorithm below: Input: A: array of n objects Input: B: array of n objects Input: n: number of elements in A and B Output: minimum distance between two points in A and B according to function dist 1 Algorithm: MinDist 2 if n = 1 then 3 return dist(A[1], B[1]); 4 else 5 mid = (n/2]; 6 A1 = A[1..mid]; 7 A2 = A[mid + 1..n]; B1 = B(1..mid); B2 = B[mid + 1..n]; 10 d11 = MinDist(A1, B1); d12 = MinDist(A1, B2); d21 = MinDist(A2, B1); 022 = MinDist(A2, B2); return min{d11, d12, d21, d22}; 15 end 8 11 12 13 14

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!