Vous êtes sur la page 1sur 5

Dynamic Programming

Thosewhocannotrememberthepastaredoomedtorepeatit
.

-----George Santayana

Definition:
Dynamic programming(also known asDynamic optimization) is a method
for solving a complex problem by breaking it down into a collection of simpler sub
problems, solving each of those sub problems just once, and storing their
solutions ideally, using a memory-based data structure.

Working Methodology:
1) Divide into Sub problems.
2) Construction of Table for Storage.
3) Combiningusing Bottom-up approach(small to big)

Dynamic Programming

Principles:

Principle of Optimality: An optimal sequence of decisions is obtained iff


each subsequence mustbe optimal
Polynomial Break-up: The breakdown into sub problems to be solved should
be a polynomial number.

Application:

In areas of information theory, operation research, computer science & AI.

Simple application

Greedy Method Vs Dynamic Programming:

If following are the denominations available 1, 5, 10, 21, 25 coins in


vending machine. And a user needs 63 cents optimal no. of coins required?
In this instance the greedy method would find the optimal solution for 63
cents in change as 6 coins ( 2x25,1x10,3x1).
However, the optimal answer is three 21 cent pieces.

Strength Fib Vs Fib Dynamic

Dynamic Programming is best used for the overlapping sub problems to save
time.

Fibonacci Series is a best example to demonstrate usage of dynamic


programming:

The Big-O in first case is O(c^n) or exponential whereas in second case its
O(n).

Vous aimerez peut-être aussi