Is it known what is the fastest Java algorithm for calculating nth term of Fibonacci sequence ?
I have found these algorithms . I guess that Iterative algorithms should be faster than Recursive and Analytic algorithms .
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Precalculate all Fibonacci numbers up to a sufficiently large number of n, and generate a source code snippet defining an array with the numbers in a type which can hold these numbers.
Then you can just retrieve the value in index
nin your array. This isO(1). Doesn’t come much faster than that.