I have wrote a recursive code of the type:
function(n){
if n==1:
return
else{
do something
function(n-1)
}
Now I am trying to analyze the complexity
I came to $T(n)=T(n-1)+1$ but how do I solve this kind of recursive relation? master theorem can not be used, I vaguely remember something like:
$$T(n)=T(n-1)+1$$ $$T(n-1)=T(n-2)+1$$ $$T(n-2)=T(n-3)+1$$
So it is of the kind $$T(n)=T(n-k)+1$$ and then we set $m=n-k$
But I do not remember how to proceed.
Note this $$T(n) - T(0) = \sum_{k=1}^n T(k) - T(k-1).$$