SlideShare a Scribd company logo
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.
When to Use 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

More Related Content

PPTX
ADA Unit 2.pptx
PDF
Dynamic Programming Algorithm CSI-504.pdf
PPTX
Computer science in Dynamic programming .pptx
PPTX
Dynamic programming in Design Analysis and Algorithms
PPTX
Dynamic Programming.pptx
PPTX
DYNAMIC_________________________PROGRAMMING.pptx
PPT
Dynamic programming
PPTX
Branch and Bound technique to solve Integer Linear Programming
ADA Unit 2.pptx
Dynamic Programming Algorithm CSI-504.pdf
Computer science in Dynamic programming .pptx
Dynamic programming in Design Analysis and Algorithms
Dynamic Programming.pptx
DYNAMIC_________________________PROGRAMMING.pptx
Dynamic programming
Branch and Bound technique to solve Integer Linear Programming

Similar to Dynamic Programing.pptx good for understanding (20)

PDF
Dynamic programming
PPTX
Module 2ppt.pptx divid and conquer method
PDF
PPTX
Flow chart and algorithm working progress
PPTX
Flow chart and algorithm working progress
PPT
Dynamic pgmming
PPSX
CC-112-Lec.1.ppsx
PPTX
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
PPTX
dinosourrrrrrrrrrrrrrrrrrrrrr formula .pptx
PPT
L17Top-DownDesigncoepttrynottoreadtheonly
PPTX
Algorithm_Dynamic Programming
PDF
Ch11_LPIntro.pdf
PDF
L21_L27_Unit_5_Dynamic_Programming Computer Science
PPTX
Dynamic programming prasintation eaisy
PDF
Analysis and Design of Algorithms notes
PPTX
Dynamic programming class 16
PPTX
Introduction to Dynamic Programming, Principle of Optimality
PPT
Pintu ram
PPT
Divide and conquer algorithm
PDF
Dynamic Programming: Memoization, Introduction to ALgorithms
Dynamic programming
Module 2ppt.pptx divid and conquer method
Flow chart and algorithm working progress
Flow chart and algorithm working progress
Dynamic pgmming
CC-112-Lec.1.ppsx
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
dinosourrrrrrrrrrrrrrrrrrrrrr formula .pptx
L17Top-DownDesigncoepttrynottoreadtheonly
Algorithm_Dynamic Programming
Ch11_LPIntro.pdf
L21_L27_Unit_5_Dynamic_Programming Computer Science
Dynamic programming prasintation eaisy
Analysis and Design of Algorithms notes
Dynamic programming class 16
Introduction to Dynamic Programming, Principle of Optimality
Pintu ram
Divide and conquer algorithm
Dynamic Programming: Memoization, Introduction to ALgorithms
Ad

More from HUSNAINAHMAD39 (7)

PPTX
GO compiler.pptx download for learning gi
PPTX
Web_Engineering_Assignment_Clean.pptxfor web
PPTX
Web_Engineering_Assignment_Clean.pptxfor college
PPTX
greedy algorithm.pptx good for understanding
PPTX
USE CASE rabia_032117.pptx very good for understanding
PPTX
Lecture-20 Kleene’s Theorem-1.pptx best for understanding the automata
PDF
Nosql Presentation.pdf for DBMS understanding
GO compiler.pptx download for learning gi
Web_Engineering_Assignment_Clean.pptxfor web
Web_Engineering_Assignment_Clean.pptxfor college
greedy algorithm.pptx good for understanding
USE CASE rabia_032117.pptx very good for understanding
Lecture-20 Kleene’s Theorem-1.pptx best for understanding the automata
Nosql Presentation.pdf for DBMS understanding
Ad

Recently uploaded (20)

PDF
Integrated-2D-and-3D-Animation-Bridging-Dimensions-for-Impactful-Storytelling...
PDF
Facade & Landscape Lighting Techniques and Trends.pptx.pdf
PDF
Key Trends in Website Development 2025 | B3AITS - Bow & 3 Arrows IT Solutions
PPTX
AC-Unit1.pptx CRYPTOGRAPHIC NNNNFOR ALL
PDF
YOW2022-BNE-MinimalViableArchitecture.pdf
PPTX
building Planning Overview for step wise design.pptx
PPT
pump pump is a mechanism that is used to transfer a liquid from one place to ...
PPTX
Wisp Textiles: Where Comfort Meets Everyday Style
PDF
BRANDBOOK-Presidential Award Scheme-Kenya-2023
PDF
Design Thinking - Module 1 - Introduction To Design Thinking - Dr. Rohan Dasg...
PPT
EGWHermeneuticsffgggggggggggggggggggggggggggggggg.ppt
PDF
Phone away, tabs closed: No multitasking
PPTX
CLASS_11_BUSINESS_STUDIES_PPT_CHAPTER_1_Business_Trade_Commerce.pptx
PPTX
An introduction to AI in research and reference management
PPTX
YV PROFILE PROJECTS PROFILE PRES. DESIGN
DOCX
actividad 20% informatica microsoft project
PPTX
Special finishes, classification and types, explanation
PPTX
DOC-20250430-WA0014._20250714_235747_0000.pptx
PDF
Quality Control Management for RMG, Level- 4, Certificate
PPTX
Entrepreneur intro, origin, process, method
Integrated-2D-and-3D-Animation-Bridging-Dimensions-for-Impactful-Storytelling...
Facade & Landscape Lighting Techniques and Trends.pptx.pdf
Key Trends in Website Development 2025 | B3AITS - Bow & 3 Arrows IT Solutions
AC-Unit1.pptx CRYPTOGRAPHIC NNNNFOR ALL
YOW2022-BNE-MinimalViableArchitecture.pdf
building Planning Overview for step wise design.pptx
pump pump is a mechanism that is used to transfer a liquid from one place to ...
Wisp Textiles: Where Comfort Meets Everyday Style
BRANDBOOK-Presidential Award Scheme-Kenya-2023
Design Thinking - Module 1 - Introduction To Design Thinking - Dr. Rohan Dasg...
EGWHermeneuticsffgggggggggggggggggggggggggggggggg.ppt
Phone away, tabs closed: No multitasking
CLASS_11_BUSINESS_STUDIES_PPT_CHAPTER_1_Business_Trade_Commerce.pptx
An introduction to AI in research and reference management
YV PROFILE PROJECTS PROFILE PRES. DESIGN
actividad 20% informatica microsoft project
Special finishes, classification and types, explanation
DOC-20250430-WA0014._20250714_235747_0000.pptx
Quality Control Management for RMG, Level- 4, Certificate
Entrepreneur intro, origin, process, method

Dynamic Programing.pptx good for understanding

  • 2. 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. 
  • 3. 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.
  • 4. When to Use 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. 
  • 5.  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.
  • 6. 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),
  • 7.  Let’s look at the diagram for better understanding.
  • 8. 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.
  • 9. 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.
  • 10. 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.
  • 11. 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