Talk:Fibonacci number program

Existence of this article

Frankly I'm baffled why anyone would put such trivial programs in an encyclopedia, but apparently this is important material. Could someone who's an expert on such topics please write a better introduction to the article?
Herbee 02:34, 2004 Mar 11 (UTC)

Yeah, I don't see any reason to keep it around. The previous introduction seemed to imply that it was a good example of recursive algorithms, but the recursive versions are massively inefficient without some sort of relatively complex improvement like memoization, and the iterative versions are easier to write anyway. The Perl program that I just got rid of wasn't even a recursive algorithm at all. I left the Scheme programs in; I don't know Scheme, but the text seems to imply that the author knows at least the difference between recursive and iterative algorithms and the difference in their running times. Overall, however, the algorithms are very simple and don't need an article of their own. If I wasn't so lazy, I would figure out how to nominate this article for deletion. --Bkell 06:16, 11 Mar 2004 (UTC)
I don't care for this article either, but I created it out of respect for the authors of two programs in the Fibonacci number article, where they did't belong. Let's not try to get it deleted right away. I'm kind of curious what this 'ugly duckling' might become.
Herbee 11:18, 2004 Mar 11 (UTC)
The reason I inserted the Perl version here in the first place, was to eliminate the need for having dozens of Fibonacci numbers in the article, but give the user an easy way to produce his own numbers instead of figuring out his own version of this trivial algorithm. IMO that's a plausible reason for this article to exist. And those new examples which replaced that version doesn't print out the numbers, the user has to find out for himself how to do it. Because of this, I took the liberty to put the first Perl version back in, which compared to the Memoize version is about twice as fast and handles big numbers. -- Sunny256 23:56, 14 Mar 2004 (UTC)
Even the scheme version doesn't seem right. It defines the inner function, making it global. To keep the function local, it should use letrec. NB, I'm a Common Lisper, but a quick google on letrec shows I'm probably not wrong.

Recursion introduction

In many beginning computer science courses, an introduction to the concept of recursion often includes a program to calculate and print Fibonacci numbers.

I don't think so, because it would be a very bad example. A more likely candidate would be the Towers of Hanoi problem, where the recursive solution has the same complexity as the iterative solution. Or Quicksort, which essentially requires recursion.
Herbee 11:18, 2004 Mar 11 (UTC)

Nevertheless, the statement might be correctish -- anyway, from my own experience IIRC (it's been like 15 yrs) we had Fibonacci and Factorial numbers as some of our first examples of recursion. --Wernher 11:43, 11 Mar 2004 (UTC)
The courses I've taken have always included some Fibonacci program as a first example of recursion. I think it's a horrible example, for obvious reasons, but it's probably done because the Fibonacci sequence is almost always defined recursively. Factorials are a better example, and they're also common. The Towers of Hanoi or quicksort are indeed good recursive examples, but for some reason I haven't seen the Towers of Hanoi used as a first example of recursion, and quicksort is probably considered too difficult to understand without a grasp of how recursion works. --Bkell 16:51, 11 Mar 2004 (UTC)
Navigation
  • Home Page (https://academickids.com/)
  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (https://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (https://academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (https://academickids.com/encyclopedia/index.php/Clipart)
  • Geography (https://academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (https:/academickids.com/encyclopedia/index.php/Countries)
    • Maps (https://academickids.com/encyclopedia/index.php/Maps)
    • Flags (https://academickids.com/encyclopedia/index.php/Flags)
    • Continents (https://academickids.com/encyclopedia/index.php/Continents)
  • History (https://academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (https://academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (https://academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (https://academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (https://academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (https://academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (https://academickids.com/encyclopedia/index.php/Timelines)
    • United States (https://academickids.com/encyclopedia/index.php/United_States)
    • Wars (https://academickids.com/encyclopedia/index.php/Wars)
    • World History (https://academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (https://academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (https://academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (https://academickids.com/encyclopedia/index.php/Reference)
  • Science (https://academickids.com/encyclopedia/index.php/Science)
    • Animals (https://academickids.com/encyclopedia/index.php/Animals)
    • Aviation (https://academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (https://academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (https://academickids.com/encyclopedia/index.php/Earth)
    • Inventions (https://academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (https://academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (https://academickids.com/encyclopedia/index.php/Plants)
    • Scientists (https://academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (https://academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (https://academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (https://academickids.com/encyclopedia/index.php/Economics)
    • Government (https://academickids.com/encyclopedia/index.php/Government)
    • Religion (https://academickids.com/encyclopedia/index.php/Religion)
    • Holidays (https://academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (https://academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (https://academickids.com/encyclopedia/index.php/Planets)
  • Sports (https://academickids.com/encyclopedia/index.php/Sports)
  • Timelines (https://academickids.com/encyclopedia/index.php/Timelines)
  • Weather (https://academickids.com/encyclopedia/index.php/Weather)
  • US States (https://academickids.com/encyclopedia/index.php/US_States)

Information

  • Contact Us (https://academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (https://classroomclipart.com)
Toolbox
Personal tools