Code4Food
2019-2-10 13:53:59
The maths formula for the nth Fibonacci numbers involves non-integers, BTW. If you just implement it naively, it will break pretty quickly even for small n. Using the closed form
is not as straight forward as one would think. Pls refer to my old post in 高登 for all the details.
Code4Food
2019-2-10 16:42:15
Well, int type is 32-bit on many common systems (64-bit is usually long int) and 32-bit signed integer can only represent up to the 46th Fibonacci number. Unless one uses the most stupid recursive algorithm with exponential time complexity, it is a moot point to talk about asymptotic time complexity.
is not as straight forward as one would think. Pls refer to my old post in 高登 for all the details.