Question: For the pseudo-code below, give the general recurrence relation expressing the worst case run time when Enigma(A,0, n-1) is called ( i.e., express T (

For the pseudo-code below, give the general recurrence relation expressing the worst case run time when Enigma(A,0, n-1) is called ( i.e., express T (n)).

Enigma(A, i, j)

{

n = j - i + 1; // the number subarray elements

if n < 4

return the sum of all array elements

k = n/4;

b1=Enigma(A, 0, n/4 - 1) b2=Enigma(A, n/4, n/2 - 1) b3=Enigma(A, n/2, 3n/4 - 1) b4=Enigma(A, 3n/4, n-1)

b = b1 + b2 + b3 + b4 return b

}

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!