f(N) is the sum of all integers which are less or equals to N.
f(N) = N + f(N-1)
= N + N-1 + N-2 + ... + 2 + 1
= N*(N+1) / 2
0
solved Figuring out the complexity of the code
f(N) is the sum of all integers which are less or equals to N.
f(N) = N + f(N-1)
= N + N-1 + N-2 + ... + 2 + 1
= N*(N+1) / 2
0
solved Figuring out the complexity of the code