Dynamic Programing.pptx good for understanding

HUSNAINAHMAD39 22 views 12 slides Jun 05, 2024
Slide 1
Slide 1 of 12
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12

About This Presentation

Heavy duty


Slide Content

Assalam.O.Alaikum Design and Analysis of Algorithms

Dynamic Programing Thought first by Richard Bellman in the 1950s , Dynamic Programming (DP) is a problem-solving technique used in computer science and mathematics to solve complex larger problems by breaking them down into simpler, smaller overlapping subproblems .

Dynamic Programing   The key idea is solving each subproblem once and storing the results to avoid redundant calculations . DP is particularly useful problem where the solution can be expressed recursively and the same subproblem appears multiple times .

W hen to U se Dynamic Programing? There are two keys: Overlapping Subproblems :   Dynamic Programming thrives on identifying and solving overlapping subproblems . These are smaller subproblems within a larger problem that are solved independently but repeatedly. By solving and storing the results of these subproblems , we avoid redundant work and speed up the overall solution.

Optimal Substructure :  Another crucial concept is the optimal substructure property. It means that the optimal solution to a larger problem can be generated from the optimal solutions of its smaller subproblems . This property allows us to break down complex problems into simpler ones and build the solution iteratively.   Let's say we've figured out the shortest route from City A to City B, and the shortest route from City B to City C. The shortest route from City A to City C via City B would be the combination of these two shortest routes. So, by knowing the optimal solutions (shortest routes) to the subproblems , we can determine the optimal solution to the original problem. That's an optimal substructure.

Practical Application : The Fibonacci Sequence To really get a grip on dynamic programming, let's explore a classic example: The Fibonacci sequence. It is a series of numbers in which each number is the sum of the two preceding ones, usually starting with 0 and 1. Fibonacci Series: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34…and so on. Mathematically, we could write each term using the formula: F(n) = F(n-1) + F(n-2),

Let’s look at the diagram for better understanding.

Types of Dynamic Programming Dynamic programming is divided into two main approaches : top-down ( memoization ) and bottom-up (tabulation). Both of these methods help in solving complex problems more efficiently by storing and reusing solutions of overlapping subproblems , but they differ in the way they go about it.

Types of Dynamic Programming Top-Down DP ( Memoization ) In the top-down approach, also known as memoization , we start with the original problem and break it down into subproblems . Think of it like starting at the top of a tree and working your way down to the leaves.

Types of Dynamic Programming Bottom-Up DP (Tabulation ): The bottom-up approach, also known as tabulation ( a bottom-up approach where complex problems are divided into simpler sub-problems . ) That takes the opposite direction. This approach solves problems by breaking them up into smaller ones, solving the problem with the smallest mathematical value, and then working up to the problem with the biggest value.

Types of Dynamic Programming Bottom-Up DP (Tabulation ): . Solutions to its subproblems are compiled in a way that falls and loops back on itself. Users can opt to rewrite the problem by initially solving the smaller subproblems and then carrying those solutions for solving the larger subproblems

Thank You! BSCS-E1
Tags