fun(int n)
{
if (n == 1)
S1 // S1 takes O(N) time
else
S2 + fun(n-1) // S2 takes O(1) time
}
What can be said about the time complexity of given Code snippet ?
I think the recurrence equation can be written as $T(N) = T(N-1) + N$ and this says Time complexity = $O(N^2)$
But I am not sure about this ?