@@ -91,15 +91,15 @@ def fib_iterative(n: int) -> list[int]:
9191def fib_recursive (n : int ) -> list [int ]:
9292 """
9393 Calculates the first n (0-indexed) Fibonacci numbers using recursion
94- >>> fib_iterative (0)
94+ >>> fib_recursive (0)
9595 [0]
96- >>> fib_iterative (1)
96+ >>> fib_recursive (1)
9797 [0, 1]
98- >>> fib_iterative (5)
98+ >>> fib_recursive (5)
9999 [0, 1, 1, 2, 3, 5]
100- >>> fib_iterative (10)
100+ >>> fib_recursive (10)
101101 [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
102- >>> fib_iterative (-1)
102+ >>> fib_recursive (-1)
103103 Traceback (most recent call last):
104104 ...
105105 ValueError: n is negative
@@ -119,7 +119,7 @@ def fib_recursive_term(i: int) -> int:
119119 >>> fib_recursive_term(-1)
120120 Traceback (most recent call last):
121121 ...
122- Exception : n is negative
122+ ValueError : n is negative
123123 """
124124 if i < 0 :
125125 raise ValueError ("n is negative" )
@@ -135,15 +135,15 @@ def fib_recursive_term(i: int) -> int:
135135def fib_recursive_cached (n : int ) -> list [int ]:
136136 """
137137 Calculates the first n (0-indexed) Fibonacci numbers using recursion
138- >>> fib_iterative (0)
138+ >>> fib_recursive_cached (0)
139139 [0]
140- >>> fib_iterative (1)
140+ >>> fib_recursive_cached (1)
141141 [0, 1]
142- >>> fib_iterative (5)
142+ >>> fib_recursive_cached (5)
143143 [0, 1, 1, 2, 3, 5]
144- >>> fib_iterative (10)
144+ >>> fib_recursive_cached (10)
145145 [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
146- >>> fib_iterative (-1)
146+ >>> fib_recursive_cached (-1)
147147 Traceback (most recent call last):
148148 ...
149149 ValueError: n is negative
@@ -176,7 +176,7 @@ def fib_memoization(n: int) -> list[int]:
176176 [0, 1, 1, 2, 3, 5]
177177 >>> fib_memoization(10)
178178 [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
179- >>> fib_iterative (-1)
179+ >>> fib_memoization (-1)
180180 Traceback (most recent call last):
181181 ...
182182 ValueError: n is negative
@@ -329,4 +329,4 @@ def fib_matrix_np(n: int) -> int:
329329 time_func (fib_memoization , num ) # 0.0100 ms
330330 time_func (fib_recursive_cached , num ) # 0.0153 ms
331331 time_func (fib_recursive , num ) # 257.0910 ms
332- time_func (fib_matrix_np , num ) # 0.0000 ms
332+ time_func (fib_matrix_np , num ) # 0.0000 ms
0 commit comments