问题
#include <stdio.h>
int fun(int n)
{
if(n>100)
return n-10;
return fun(fun(n+11));
}
int main()
{
int r;
r=fun(95);
printf("%d\n",r);
return 0;
}
the answer says time complexity is O(n), can anyone explain how?
来源:https://stackoverflow.com/questions/62381491/how-to-calculate-the-time-and-space-complexity-of-this-nested-recursive-function