Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #87840

Re: fibonacci series what Iam is missing ?

Date 2015-03-23 14:07 -0400
From Dave Angel <davea@davea.name>
Subject Re: fibonacci series what Iam is missing ?
References <CACT3xuVF-MOVQK5wSorRSAfpAQEXvS7QsqarACVZKXsQ0bxzpQ@mail.gmail.com> <55103C5D.4070305@davea.name> <CAPTjJmr6rN84BXqsAyhSN1x-SHA+6htGCeu6F=NTJjk6nHxAFQ@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.77.1427134087.10327.python-list@python.org> (permalink)

Show all headers | View raw


On 03/23/2015 12:59 PM, Chris Angelico wrote:
> On Tue, Mar 24, 2015 at 3:16 AM, Dave Angel <davea@davea.name> wrote:
>> An entirely separate question is whether you can gain performance by caching
>> intermediate values.  For example, if you capture values in a list, you
>> could potentially save a lot of time, at least for non-trivial values of n.
>
> If you take a step back and seek to print a sequence of Fibonacci
> numbers, rather than calculating specific ones based on their indices,
> then you don't even need to consider caching. As soon as you've
> printed out a number, you move right along.
>

But that's a big assumption.  I assumed the comment on the function had 
a reasaonable meaning, that the OP assignment was to learn about recursion.

If I were the instructor, I might have assigned them to print the 
fibonacci numbers backwards:

5  5
4  3
3  2
2  1
1  1
0  0


-- 
DaveA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: fibonacci series what Iam is missing ? Dave Angel <davea@davea.name> - 2015-03-23 14:07 -0400

csiph-web