Consider the following code:
ones(n)
{
if(n==0)
printf("1");
else
for(i=1;i<=2n;i++)
ones(n-1);
}
Number of 1's printed by above code is:
1
\(\theta(2^{n(n+1)/2)})\)
2
\(\theta(2^n)\)
3
\(\theta(2^{n^2})\)
4
\(\theta(n)\)
Consider the following code:
ones(n)
{
if(n==0)
printf("1");
else
for(i=1;i<=2n;i++)
ones(n-1);
}
Number of 1's printed by above code is: