Re: What make function with huge list so slow

2019-08-25 Thread Windson Yang
> Figure out how much memory fib_dp is holding on to right before it returns > the answer. fib(40) is a _big_ number! And so is fib(39), and > fib(38), and fib(37), etc. By the time you're done, you're holding > on to quite a huge pile of storage here. Depending on how much phys

Re: What make function with huge list so slow

2019-08-25 Thread Alan Bawden
Windson Yang writes: > 'I'm just running them in succession and seeing how long they'. The full > code looks like this, this is only an example.py here. and I run 'time > python3 example.py' for each function. > > def fib_dp(n): > dp = [0] * (n+1) > if n <= 1: > r