HackerPapers

arXiv:1803.07199cs.DS

Twelve Simple Algorithms to Compute Fibonacci Numbers

Ali Dasdan

Abstract

The Fibonacci numbers are a sequence of integers in which every number after the first two, 0 and 1, is the sum of the two preceding numbers. These numbers are well known, and the algorithms to compute them are simple enough that they are often used in introductory algorithms courses. In this paper, we present twelve such algorithm together with their time and space complexity analyses. Though very simple, these algorithms illustrate eleven concepts from the algorithms field, ranging from top-down vs. bottom-up dynamic programming to recursion depth, and we say which algorithms illustrate which concept. We also present the results of a small-scale experimental comparison of their runtimes on a personal laptop, where the slowest algorithm takes about four orders of magnitude longer than the fastest. Finally, we provide a list of homework questions for students. We hope that this paper can serve as a useful resource for students learning the basics of algorithms.

arXiv comments
37 pages, 11 figures
Journal reference
DOI
Subjects
cs.DSData Structures and Algorithms

On Hacker News

Linked by 2 identifiable commenters in 2 comments across 2 threads, from Feb 2019 to Jan 2022. Found in 1 HN submission from Feb 2020 to Feb 2020. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments2 threads

    • No, I am not saying that. I am saying we can compute F(n) exactly in O(log n) time. All the digits. That Fibonacci identity I posted allows computing exactly every single integer digit by rounding at the end, because the other term goes to zero as n goes to infinity, and that…

      ChrisLomontView on HNParent context

    • For students learning introduction to algorithms, I have implementations for 12 simple Bibonacci number computation algorithms at https://github.com/alidasdan/fibonacci-number-algorithms . A related paper is at https://arxiv.org/abs/1803.07199 . Hope they can be useful.

      noblestoneView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.