Dynamic Programming and Applications
Dynamic Programming and Applications
Applications
Design & Analysis of Algorithm
DP will solve each of them once and their answers are stored in a table for
future use.
Here,n is the user input. To illustrate how the Fibonacci function can be solved using the
dynamic programming approach, we’re taking the input value n = 5. In the first phase,
we divide the original problem into sub-problems. Unlike divide and conquer, it computes
the sub-problems iteratively and stores the solutions for future use.
Finally, we combine the solutions of the sub-problems to achieve the solution of the main
problem:
• The complexity for the multiplication of two matrices using the naive method
is O(n3), whereas using the divide and conquer approach (i.e. Strassen's
matrix multiplication) is O(n2.8074). This approach also simplifies other
problems, such as the Tower of Hanoi.
• This approach is suitable for multiprocessing systems.
• It makes efficient use of memory caches.
• Dynamic Programming solves optimization problems by dividing them into smaller but similar
subproblems whose results are stored and used again.
• Dynamic Programming algorithm works by computing the answer to all possible subproblems
and storing them to find an optimal answer. This process of storing values of subproblems is
called memorization.
• A problem can be solved by using the Dynamic Programming algorithm if it follows these two
characteristics:
• Optimal Substructure
• Overlapping Subproblems
• here are two types of approaches that can be used to solve a problem by
Dynamic Programming :
• Memorization or Top-Down Dynamic Programming
• Tabulation or Bottom Up Dynamic Programming