File tree 1 file changed +2
-4
lines changed
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]:
61
61
fib .append (fib [- 1 ] + fib [- 2 ])
62
62
return fib
63
63
64
+
64
65
def fib_iterative_yield (n : int ) -> Generator [int ]:
65
66
"""
66
67
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]:
213
214
return [round (phi ** i / sqrt_5 ) for i in range (n + 1 )]
214
215
215
216
216
-
217
-
218
217
if __name__ == "__main__" :
219
218
num = 30
220
219
time_func (fib_iterative , num )
221
220
time_func (fib_recursive , num ) # Around 3s runtime
222
221
time_func (fib_recursive_cached , num ) # Around 0ms runtime
223
222
time_func (fib_memoization , num )
224
223
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