On 2008-06-29, slix <[EMAIL PROTECTED]> wrote: > Recursion is awesome for writing some functions, like searching trees > etc but wow how can it be THAT much slower for computing fibonacci- > numbers?
Try the following recursive function:
def fib(n):
def gfib(a, b , n):
if n == 0:
return a
else:
return gfib(b, a + b, n - 1)
return gfib(0, 1, n)
--
Antoon Pardon
--
http://mail.python.org/mailman/listinfo/python-list
