1 / 14

What Is Dynamic Programming? | Dynamic Programming Explained | Simplilearn

This presentation on 'What Is Dynamic Programming?' will acquaint you with a clear understanding of how this programming paradigm works with the help of a real-life example. In this Dynamic Programming Tutorial, you will understand why recursion is not compatible and how you can solve the problems involved in recursion using DP. Finally, we will cover the dynamic programming implementation of the Fibonacci series program. So, let's get started!

Simplilearn
Download Presentation

What Is Dynamic Programming? | Dynamic Programming Explained | Simplilearn

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Agenda

  2. Agenda Problem Statement

  3. Click here to watch the video

  4. Agenda Algorithmic solution

  5. Agenda Implementation

  6. Problem Statement

  7. Problem Statement 1 4 2 3 6 8 7 10 2 9 2 2 2 2 2 We will be given a set of non-negative integers, and a value sum, we must determine if there is a subset of the given set with sum equal to given sum.

  8. Algorithmic Solution

  9. Algorithmic Solution We will create a 2D array of size (arr.size() + 1) * (target + 1) of type boolean.

  10. Algorithmic Solution We will create a 2D array of size (arr.size() + 1) * (target + 1) of type boolean. The state DP[i][j] will be true if there exists a subset of elements from A[0….i] with sum value = ‘j’.

  11. Algorithmic Solution We will create a 2D array of size (arr.size() + 1) * (target + 1) of type boolean. The state DP[i][j] will be true if there exists a subset of elements from A[0….i] with sum value = ‘j’. Pseudocode: if (A[i-1] > j) DP[i][j] = DP[i-1][j] else DP[i][j] = DP[i-1][j] OR DP[i-1][j-A[i-1]]

  12. Implementation

More Related