Skip to content

Commit 9d48190

Browse files
committed
Rechecked and resolve the problem issue #475
1 parent f84c2bf commit 9d48190

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

pydatastructs/multi_threaded_algorithms/fibonacci.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ def __init__(self, n, backend='python'):
1616
self.backend = backend
1717
self.result = [None] * (n + 1) # To store Fibonacci numbers
1818
self.threads = [] # List to store thread references
19-
2019
# Check for valid backend
2120
if backend != 'python':
2221
raise NotImplementedError(f"Backend '{backend}' is not implemented.")

pydatastructs/multi_threaded_algorithms/tests/test_fibonacci.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_Fibonacci_with_threading():
4949
# Test the Fibonacci sequence correctness for medium size n
5050
assert f_medium.sequence == [
5151
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181,
52-
6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229
52+
6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040
5353
]
5454

5555
# Check that sequence length is correct for large n (e.g., Fibonacci(50))
@@ -75,11 +75,9 @@ def test_Fibonacci_with_threads():
7575
# Test multi-threaded calculation is correct for different n
7676
f_threaded = Fibonacci(25)
7777
assert f_threaded.calculate() == 75025 # Fibonacci(25)
78-
7978
# Validate that the thread pool handles large n correctly
8079
f_threaded_large = Fibonacci(40)
8180
assert f_threaded_large.calculate() == 102334155 # Fibonacci(40)
82-
8381
# Ensure that no threads are left hanging (checks for thread cleanup)
8482
threads_before = threading.active_count()
8583
f_threaded.calculate()

0 commit comments

Comments
 (0)