def fib(n):
    def fibt(a, b, n):
        if n <= 1:
            return b
        else:
            return fibt(b, a + b, n - 1)
    if n == 0:
        return 0
    else:
        return fibt(0, 1, n);


and can memoization speed up this even more? tesintg with memoization
doesnt really say anything because it is so fast it is instant anyway.


(the classic easy-redable exponential fib-function can obv be helped
enormously with memoization though.)
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to