J
Johnny Shih
Hi guys,
I am having to figure out the recusion in this function.
int recfn(int v)
{
if(v==1 || v==0)
return 1;
if(v%2==0)
return recfn(v/2)+2;
else
return recfn(v-1)+3;
}
recfn(7) gives me 11
I am not able to figure out the steps and numbers that got added up to that.
Please help.
Thanks alot,
Johnny
I am having to figure out the recusion in this function.
int recfn(int v)
{
if(v==1 || v==0)
return 1;
if(v%2==0)
return recfn(v/2)+2;
else
return recfn(v-1)+3;
}
recfn(7) gives me 11
I am not able to figure out the steps and numbers that got added up to that.
Please help.
Thanks alot,
Johnny