diff --git a/Project/Python Progs/Dynamic programming.py b/Project/Python Progs/Dynamic programming.py new file mode 100644 index 00000000..48ab8310 --- /dev/null +++ b/Project/Python Progs/Dynamic programming.py @@ -0,0 +1,11 @@ +def fibonacci_tabulation(n): + if n <= 1: + return n + fib = [0] * (n+1) + fib[1] = 1 + for i in range(2, n+1): + fib[i] = fib[i-1] + fib[i-2] + return fib[n] + +# Example usage: +print(fibonacci_tabulation(10)) # Output: 55