File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ def fib_recursive_term(i: int) -> int:
122122 raise ValueError ("n is negative" )
123123 return [fib_recursive_term (i ) for i in range (n + 1 )]
124124
125+
125126def fib_recursive_cached (n : int ) -> list [int ]:
126127 """
127128 Calculates the first n (0-indexed) Fibonacci numbers using recursion.
@@ -155,6 +156,7 @@ def fib_recursive_term(i: int) -> int:
155156 raise ValueError ("n is negative" )
156157 return [fib_recursive_term (i ) for i in range (n + 1 )]
157158
159+
158160def fib_memoization (n : int ) -> list [int ]:
159161 """
160162 Calculates the first n (0-indexed) Fibonacci numbers using memoization
@@ -320,4 +322,3 @@ def fib_matrix_np(n: int) -> int:
320322 time_func (fib_recursive_cached , num ) # 0.0153 ms
321323 time_func (fib_recursive , num ) # 257.0910 ms
322324 time_func (fib_matrix_np , num ) # 0.0000 ms
323-
You can’t perform that action at this time.
0 commit comments