@rahul tiwari..i have that soln...i think u cnt get questionhw do we knw
the number of terms?/
On Sun, Oct 2, 2011 at 2:09 PM, Rahul Tiwari rahultiwari6...@gmail.comwrote:
working code :
#includestdio.h
int fib(int n)
{
if(n==1) return 0;
if(n==2) return 1;
gr 8 soln...thnx
2011/10/2 akanksha akanksha.271...@gmail.com
int sum(int f0,int f1)
{
if(f1=1000)
{
int x= sum(f1,f0+f1);
if(f1%2==0) x+=f1;
return x;
}
else
return 0;
}
--
You received this message because you are subscribed to the
there must be a non brute force approach too rite???
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
yea...first sol is brute force...but this is not..that is posted by
akanshai think...but not sure...the question wants only
recursivehoope sumone may come with sumthng new
On Sun, Oct 2, 2011 at 10:35 AM, Siddhartha Banerjee
thefourrup...@gmail.com wrote:
there must be a non brute
this is bruteforce. You are calculating all fib. numbers.
On Sun, Oct 2, 2011 at 10:38 AM, rahul sharma rahul23111...@gmail.comwrote:
yea...first sol is brute force...but this is not..that is posted by
akanshai think...but not sure...the question wants only
recursivehoope sumone may
Using Wladimir's formulas, you have:
F(0) + F(1) + F(2) + F(3) + F(4) + F(5) + F(6) + ... + F(3n-2) + F(3n-1) +
F(3n) = F(3n+2) - 1
F(0) +(F(1) + F(2))+ F(3) +(F(4) + F(5))+ F(6) + ... +(F(3n-2) + F(3n-1))+
F(3n) = F(3n+2) - 1
F(0) + 2F(3) + 2F(6) + ... + 2F(3n) = F(3n+2) - 1
Since F(0) = 0,