File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ def fib_iterative(n: int) -> list[int]:
6161 fib .append (fib [- 1 ] + fib [- 2 ])
6262 return fib
6363
64+
6465def fib_iterative_yield (n : int ) -> Generator [int ]:
6566 """
6667 Calculates the first n (1-indexed) Fibonacci numbers using iteration with yield method to save memory
@@ -213,14 +214,11 @@ def fib_binet(n: int) -> list[int]:
213214 return [round (phi ** i / sqrt_5 ) for i in range (n + 1 )]
214215
215216
216-
217-
218217if __name__ == "__main__" :
219218 num = 30
220219 time_func (fib_iterative , num )
221220 time_func (fib_recursive , num ) # Around 3s runtime
222221 time_func (fib_recursive_cached , num ) # Around 0ms runtime
223222 time_func (fib_memoization , num )
224223 time_func (fib_binet , num )
225- time_func (fib_iterative_yield , num )
226-
224+ time_func (fib_iterative_yield , num )
You can’t perform that action at this time.
0 commit comments