Computing the time complexity of functions when both contain each other?
1 answer
The way to solve this problem is to look at what the functions are actually doing. There is no general rule. You just need to turn on your brain.
When you call foo (1000), how many calls to foo (999) will be made at least? How many calls will foo (998) be made at least?
...
How many calls to foo (501) will be made at least? How many calls to foo (500) will be made at least?
-2
source to share