Sorry line number 7 is a[n]=fibo(n-1)+fibo(n-2); On Mon, Jun 6, 2011 at 6:25 PM, saurabh singh <saurab...@gmail.com> wrote:
> long a[10000000]={0,1}; > long fibo(long n) > { > if(a[n]) return a[n]; > else > { > a[n]=fibo(n-1)+sum(n); > return a[n]; > > } > } > > On Mon, Jun 6, 2011 at 6:19 PM, Aakash Johari <aakashj....@gmail.com>wrote: > >> Memoize your solution for nth fibonacci and use this memoized value in >> further computations. >> >> >> On Mon, Jun 6, 2011 at 5:42 AM, kumar vr <kumarg...@gmail.com> wrote: >> >>> The Fibonacci series Recursion using >>> F(n) = F(n-1) + F(n-2) >>> Will of exponential complexity. >>> This occurs because each of the Term is calculated twice >>> eg >>> F5= F4+F3 >>> F4= F3+F2. >>> >>> So F3 calculation is done twice. >>> >>> Can someone come up with an algorithm to minimize these computation and >>> come up with efficent algorithm. >>> >>> >>> >>> -- >>> 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 >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >> >> -- >> -Aakash Johari >> (IIIT Allahabad) >> >> >> >> >> >> -- >> 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 >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > Saurabh Singh > B.Tech (Computer Science) > MNNIT ALLAHABAD > > > -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.