File tree Expand file tree Collapse file tree 4 files changed +21
-0
lines changed
Expand file tree Collapse file tree 4 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ %%
2+ % Author: Mansour Torabi,
3+ % Contact: smtoraabi@ymail.com
4+
5+ %%
16
27% Using Recursive Method
38tic ; Fibo1(40 ); toc
Original file line number Diff line number Diff line change 11function f = Fibo1(n )
2+ %%
3+ % Author: Mansour Torabi,
4+ % Contact: smtoraabi@ymail.com
5+
6+ %%
7+
28% Fibonacci using Recursive Solution
39
410% Time Complexity: O(2^n)
Original file line number Diff line number Diff line change 11function F = Fibo2(n )
2+ %%
3+ % Author: Mansour Torabi,
4+ % Contact: smtoraabi@ymail.com
5+
6+ %%
27% Fibonacci using Dynamic Programming (DP)
38% DP: recursion + memoziation
49
Original file line number Diff line number Diff line change 11function F = Fibo3(n )
2+ %%
3+ % Author: Mansour Torabi,
4+ % Contact: smtoraabi@ymail.com
25
6+ %%
37% Fibonacci Numbers using Matrix Exponentiation
48% Time Complexity: O(log(n))
9+
510f0 = 0 ;
611f1 = 1 ;
712
You can’t perform that action at this time.
0 commit comments