Following is a Simple Recursive Function .I have made its Recurrence equation like this
T(n)=kT(n-1)+1
I have used + 1 for int i; I have Solved it like this
T(n)=kT(n-1)+1 . . . T(n)=k^mT(n-m)+m
To make T(1)-> n-m=1 -> m=n-1
it becomes ( k^n-1 )(n-1)
Now my question is ,Is it fine .I was expecting it n^2 but this is something not seems to be polynomial.
void permute(int k,int size)
{
int i;
for (i=k-1;i>=0;i--)
permute(k-1,size);
return;
}
Kindly help me how to solve this Short problem