Question: Consider the following algorithm: 1: function SUMELEMENT(array A) if length(A)1 3: return A0 else ?: 6: 7: 8: end function Al A[0: length(A)/2] A2Allength(A)/2: length(A)]

Consider the following algorithm: 1: function SUMELEMENT(array A) if length(A)1 3: return A0 else ?: 6: 7: 8: end function Al A[0: length(A)/2] A2Allength(A)/2: length(A)] return SumElement(A1) + 2* SumElement (A2) Assume that items in the first half of array A are copied into array Al and the items in the second half of array A are copied into array A2 (i.e. these are O(n) operations). 1. Write the running time of this function as a recurrence relation. 2. Using Master Method give the running time complexity of this function in Big O notation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
