Abstract

There are too many examples and programming guides (which, e.g., an internet search for "recursive procedure Fibonacci" will turn up) to count that use Fibonacci numbers as an example to illustrate recursive programming. The motivation for this article is to show why the naive way of doing this is a bad idea, as it is horrendously inefficient. We will exhibit much more efficient ways of computing Fibonacci numbers, both iterative and recursive, and analyze and compare worst case running times and memory usages. Using some mathematical properties of Fibonacci numbers leads to the most efficient method for their computation. For illustration and benchmarking, we will use Maple and its programming language, however, similar behaviour can be demonstrated in almost any other programming language. This exposition combines and explores the mathematical properties of Fibonacci numbers, notions of algorithmic complexity, and efficient Maple programming and profiling techniques, and may be used as an introduction to any of these three subjects. The techniques described can be readily generalized to more general types of linear recurrences with constant coefficients.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.