Open In App

Dynamic Programming meaning in DSA

Improve
Improve
Like Article
Like
Save
Share
Report

Dynamic Programming is defined as an algorithmic technique that is used to solve problems by breaking them into smaller subproblems and avoiding repeated calculation of overlapping subproblems and using the property that the solution of the problem depends on the optimal solution of the subproblems

Properties of Dynamic Programming:

  • Optimal Substructure: Dynamic programming can be used to solve a problem if its optimal solution can be built from the optimal solutions of its subproblems. We can divide a problem into smaller subproblems and solve them separately thanks to this characteristic.
  • Overlapping Subproblems: If a problem can be divided into smaller subproblems that are applied more than once throughout the calculation, it has overlapping subproblems. This characteristic enables us to avoid answering subproblems more than once by storing the answers in a table or memoization array.
  • Memoization: Memory is a method for storing the outcomes of pricey function calls and returning the stored result when the same inputs are provided again. This saves time and prevents needless function calls.

Applications of Dynamic Programming:

  • Dynamic programming is used to solve economic like resource allocation, optimal growth, and decision-making.
  • Problems in game theory like optimal strategies, value iteration, and Markov decision processes are solved using dynamic programming.
  • To solve issues like speech recognition, machine translation, and language modelling, dynamic programming is used in natural language processing.

Advantages of Dynamic Programming:

  • Efficiency gain: For addressing difficult problems, dynamic programming may significantly reduce time complexity compared to the naïve technique.
  • Dynamic programming ensures that issues that adhere to the notion of optimality find optimal solutions.

Disadvantages of Dynamic Programming:

  • High memory usage: When working with bigger input sizes, dynamic programming uses a lot of memory to hold answers to sub-problems.
  • Finding the appropriate sub-problems can be difficult, and doing so frequently necessitates a deep understanding of the main issue at hand.

What else can you read?


Last Updated : 30 Mar, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads