engineering recuitment GATE CSE 2023-24 Test Series Algorithms Asymptotic Worst Case Time and Time Complexity Recurrences
What is the time complexity for the following C module? Assume that n > 0;
int module(int n)
{
if(n == 1)
return 1;
else
return (n + module(n-1));
}
1
O(n)
2
O(log n)
3
O(n2)
4
O(n!)