Originally posted by AlbaLed
It does make sense, but one part that you're loosing me is why do you switch to ln(n).
For f(n) I guess you can put O(1), and your runtime is good.
Another case is, if nonevent is looking for is actually calls to f(n) if this was a recurrence problems like this
f(n) = n%3 (n =1,2,3)
f(n) = nf(n-1)
which is then going to be n!/3!, and then the recurrence start to unroll.
The above might be the case if nonevent made a typo, instead of writing
function f(n) {
if (n
< 3) return n % 3;
return n*f(n-1);
}
Bookmarks