- Notifications
You must be signed in to change notification settings - Fork3
Mansourt/Matlab_Dynamic_Programming
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Dynamic Programming has been demostrated by two examples:
- Fibonacci sequence
- Find number of path in the Grid Map with obstacles
Just run theFibonacci/EVAL_fibo.m file to compare run-time of the following three methods:
- Fibo usingRecursive method
- Fibo usingDynamic programming
- Fibo usingMatrix Exponentiation (Fastest method)
Fibonacci/Fibo_R.m: Fibonacci with Recursive approach:
- Time Complexity: O(2^n)
- Space Complexity: O(2^n)
Fibonacci/Fibo_DP.m: Fibonacci with Dynamic programming (Memoization):
- Time Complexity: O(n)
- Space Complexity: O(n)
Fibonacci/Fibo_M.m: Fibonacci with Matrix Exponentiation:
- Time Complexity: O(log(n))
Just run theGrid Path/EVAL_grid_path.m file to compare run-time of the following two methods:
- Count number of path usingRecursive method
- Count number of path usingDynamic Programming
clc,clear% Define Map (Grid Path)Map= zeros(15,10);Map(3,5)=1;Map(6,7)=1;Map(7,3)=1;% Visualize Map (Grid Path)MapView(Map)%%tic;N1= GridPath_R(Map,1,1)toc;tic;N2= GridPath_DP(Map,1,1)toc;
Grid map is as follows:
N1=475550Elapsedtime is 8.417751 seconds.N2=475550Elapsedtime is 0.002251 seconds.
Email:smtoraabi@ymail.com
About
Dynamic Programming has been implemented in MATLAB using two illustrative example
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
