I have a recursive algorithm like :
int alg(int n) {
if (n == 0)
return 2;
for (int i = 0; i<= n-1; ++i)
alg(i);
}
Obviously the n == 0 case is Θ(1). However I am having trouble understanding how it really works. I mean it must be something like :
T(n) = T(0) + T(1) + ... + T(n-1).
And then we have to give T(1), T(2), .., T(n-1) = xT(0). I can understand the way it goes for n=0 and n=1, but for bigger n it goes wrong.