Fibonacci series recursion error

Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Sat Apr 30 05:37:22 EDT 2011


Am 30.04.2011 07:35, schrieb harrismh777:
> Ian Kelly wrote:
>> since the fact is that if
>> the function were properly coded, the call stack for fib(20) would
>> never be more than 20 entries deep at any one time.
>
> Not so much... and much more !....
>
> ... because each recursion level 'return' calls fib() twice, and each of
> those calls fib() twice, and you get the point...

yes - but they are called one after the other, so the "twice" call 
counts only for execution speed, not for recursion depth.


Thomas



More information about the Python-list mailing list