- #1
tsgiannis
- 1
- 0
Homework Statement
Hello to everybody
I have this homework and my main issue is that is cannot find any bibliography to read that does what my homework requires.
The problem goes like
We have this recursive algorithm that calculates the sum of an array elements from array element k to array element n
procedure sum(A, left, right)
if left ? right then
if left = right then return(A
);
else return(0);
mid := [(left + right) / 2];
x := sum(A, left, mid);
y := sum(A, mid+1, right);
return(x + y);
The problem goes like this
If the array A has n elements that are an expression of 2 (like 8 = 2^3) find the depth of recursion for the call of the procedre sum(A,1,n)
I don't ask for the solution but just a helping hand to find some relative material.
else return(0);
mid := [(left + right) / 2];
x := sum(A, left, mid);
y := sum(A, mid+1, right);
return(x + y);
The problem goes like this
If the array A has n elements that are an expression of 2 (like 8 = 2^3) find the depth of recursion for the call of the procedre sum(A,1,n)
I don't ask for the solution but just a helping hand to find some relative material.