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!)

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation