SlideShare a Scribd company logo
5
Most read
7
Most read
10
Most read
Dynamic
Programming
Ahsan Raza
EXAMPLE(Fibonacci Sequence/Series)
f(n)
{
if(n==0)
return 0;
if(n==1)
return 1;
if(n>1)
return (f(n-1)+f(n-2);
}
n : 1 2 3 4 5 6 7 8 9 1 0
f(n): 0 1 1 2 3 5 8 13 21 34 55
F(5)
F(3)
F(4)
F(3)
F(1)
F(2)
F(2)
F(0)
F(1)
F(1)
F(2)
F(0)
F(1)
F(0)
F(1)
• It's a powerful algorithm
technique.
• •Used for Optimization
problems
• Solve complex problems by
breaking them into smaller
subproblems.
• Optimal substructure and
overlapping subproblems.
INTRODUCTION
Two Fundamental
Principles
• Optimal Substructure
• Overlapping Subproblems
FUNDAMENTALS
Optimal Substructure means we
can break a big problem into smaller
subproblems, and if we solve those
smaller subproblems optimally, we
can combine their solutions to solve
the big problem optimally.
OPTIMAL SUBSTRUCTURE:
EXAMPLE: JIGSAW PUZZLE
Overlapping Subproblems refers to
the situation where the same smaller
problems are encountered and solved
multiple times when solving a larger
problem.It's about reusing solutions to
avoid redundant work.
OVERLAPPING SUBPROBLEMS
Memoization(Top-Down)
A lookup table is maintained and
checked before computation of any
state.Recursion is involved.
WAYS TO HANDLE OVERLAPPING SUBPROBLEMS
Tabulation(Bottom-Up)
Solution is built from base.It is an
iterative process.
Dynamic programming, specifically memoization or
tabulation, helps here by storing the results of these
subproblems the first time you solve them.When you
need the same result again, you simply look it up,
avoiding redundant calculations.This significantly
improves efficiency, especially for larger problems.
• Space complexity
• Complexity of identifying subproblems
• Inability to handle problems without
optimal substructure:
LIMITATIONS
LIMITATIONS
• Efficiency: It can improve the efficiency of
algorithms by avoiding redundant computations.
• Optimality: The algorithms are guaranteed to
find optimal solutions to problems with optimal
substructure.
• Generality: Dynamic programming can be
applied to a wide variety of problems.
ADVANTAGES
ADVANTAGES
Thank you.

More Related Content

PPTX
DYNAMIC_________________________PROGRAMMING.pptx
PPTX
6-Python-Recursion PPT.pptx
PPT
Lec-6 Recursion of Data Structures & Algorithms
PPT
Dynamic pgmming
PDF
Dynamic programming
PPT
Balaji-opt-lecture6-act.ppt
PPTX
dynamic-programming
PDF
Dynamic programing
DYNAMIC_________________________PROGRAMMING.pptx
6-Python-Recursion PPT.pptx
Lec-6 Recursion of Data Structures & Algorithms
Dynamic pgmming
Dynamic programming
Balaji-opt-lecture6-act.ppt
dynamic-programming
Dynamic programing

Similar to Dynamic Programming Intro in Algorithm Design (20)

PDF
Sure interview algorithm-1103
PPTX
Dynamic Programming.pptx
PDF
Branch-and-Bound Technique for Solving Integer Programs
 
PPTX
NON LINEAR PROGRAMMING
DOCX
Solving Optimization Problems using the Matlab Optimization.docx
PPT
Balaji-opt-lecture5-linear program sp13.ppt
PPTX
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
PPTX
Algorithm_Dynamic Programming
PPTX
Annotaed slides for dynamic programming algorithm
PPT
Functions
PPT
daa_notes_of_backtracking_branchandbound.ppt
PDF
Algorithm review
PPT
dynamic programming Rod cutting class
PPTX
10 - Recursive.pptx
PPTX
lecture4-recursion.pptx
PPTX
Introduction to TreeNet (2004)
PPTX
Dynamic programming class 16
PDF
Skiena algorithm 2007 lecture16 introduction to dynamic programming
PPT
ERK_SRU_ch08-2019-03-27.ppt discussion in class room
PDF
Reading papers - survey on Non-Convex Optimization
Sure interview algorithm-1103
Dynamic Programming.pptx
Branch-and-Bound Technique for Solving Integer Programs
 
NON LINEAR PROGRAMMING
Solving Optimization Problems using the Matlab Optimization.docx
Balaji-opt-lecture5-linear program sp13.ppt
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
Algorithm_Dynamic Programming
Annotaed slides for dynamic programming algorithm
Functions
daa_notes_of_backtracking_branchandbound.ppt
Algorithm review
dynamic programming Rod cutting class
10 - Recursive.pptx
lecture4-recursion.pptx
Introduction to TreeNet (2004)
Dynamic programming class 16
Skiena algorithm 2007 lecture16 introduction to dynamic programming
ERK_SRU_ch08-2019-03-27.ppt discussion in class room
Reading papers - survey on Non-Convex Optimization
Ad

More from AhsanRazaKolachi (20)

PPTX
Freequency Shift Keying in Digital to Analog Conversion
PPTX
What are Control Units in Computer Architecture
PPTX
Game Theory in operational research slideshare
PPTX
Minimum Weight Spanning Tree in Operational Research
PPTX
stochastic models in operational research
PPTX
Evolution in military technology by ahsan raza
PPTX
Flags register in central processing unit
PPTX
what is System Analyst in Software Development
PPTX
Process , Process states , Process Control Block in Operating Systems
PPTX
Rapid Application Development in Software Engineering
PPTX
Index registers in Central Processing Unit
PPTX
Data transmission Services in Data Warehouse
PPTX
What is Palindrome in Compiler Design and Tafl
PPTX
Information Technology
PPTX
PPTX
Nelsen ten Heuristics
PPTX
two wordpress plugins
PPTX
Graph in data structures
PPTX
Statistics and Role of statistics in Computer Science
PPTX
Radio Waves In Computer Communication
Freequency Shift Keying in Digital to Analog Conversion
What are Control Units in Computer Architecture
Game Theory in operational research slideshare
Minimum Weight Spanning Tree in Operational Research
stochastic models in operational research
Evolution in military technology by ahsan raza
Flags register in central processing unit
what is System Analyst in Software Development
Process , Process states , Process Control Block in Operating Systems
Rapid Application Development in Software Engineering
Index registers in Central Processing Unit
Data transmission Services in Data Warehouse
What is Palindrome in Compiler Design and Tafl
Information Technology
Nelsen ten Heuristics
two wordpress plugins
Graph in data structures
Statistics and Role of statistics in Computer Science
Radio Waves In Computer Communication
Ad

Recently uploaded (20)

PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Digital Strategies for Manufacturing Companies
PDF
System and Network Administraation Chapter 3
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Introduction to Artificial Intelligence
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
history of c programming in notes for students .pptx
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
top salesforce developer skills in 2025.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
Operating system designcfffgfgggggggvggggggggg
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Digital Strategies for Manufacturing Companies
System and Network Administraation Chapter 3
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Softaken Excel to vCard Converter Software.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
2025 Textile ERP Trends: SAP, Odoo & Oracle
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Introduction to Artificial Intelligence
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Upgrade and Innovation Strategies for SAP ERP Customers
wealthsignaloriginal-com-DS-text-... (1).pdf
history of c programming in notes for students .pptx
Design an Analysis of Algorithms II-SECS-1021-03
top salesforce developer skills in 2025.pdf
PTS Company Brochure 2025 (1).pdf.......

Dynamic Programming Intro in Algorithm Design

  • 2. EXAMPLE(Fibonacci Sequence/Series) f(n) { if(n==0) return 0; if(n==1) return 1; if(n>1) return (f(n-1)+f(n-2); } n : 1 2 3 4 5 6 7 8 9 1 0 f(n): 0 1 1 2 3 5 8 13 21 34 55 F(5) F(3) F(4) F(3) F(1) F(2) F(2) F(0) F(1) F(1) F(2) F(0) F(1) F(0) F(1)
  • 3. • It's a powerful algorithm technique. • •Used for Optimization problems • Solve complex problems by breaking them into smaller subproblems. • Optimal substructure and overlapping subproblems. INTRODUCTION
  • 4. Two Fundamental Principles • Optimal Substructure • Overlapping Subproblems FUNDAMENTALS
  • 5. Optimal Substructure means we can break a big problem into smaller subproblems, and if we solve those smaller subproblems optimally, we can combine their solutions to solve the big problem optimally. OPTIMAL SUBSTRUCTURE: EXAMPLE: JIGSAW PUZZLE
  • 6. Overlapping Subproblems refers to the situation where the same smaller problems are encountered and solved multiple times when solving a larger problem.It's about reusing solutions to avoid redundant work. OVERLAPPING SUBPROBLEMS
  • 7. Memoization(Top-Down) A lookup table is maintained and checked before computation of any state.Recursion is involved. WAYS TO HANDLE OVERLAPPING SUBPROBLEMS Tabulation(Bottom-Up) Solution is built from base.It is an iterative process.
  • 8. Dynamic programming, specifically memoization or tabulation, helps here by storing the results of these subproblems the first time you solve them.When you need the same result again, you simply look it up, avoiding redundant calculations.This significantly improves efficiency, especially for larger problems.
  • 9. • Space complexity • Complexity of identifying subproblems • Inability to handle problems without optimal substructure: LIMITATIONS LIMITATIONS
  • 10. • Efficiency: It can improve the efficiency of algorithms by avoiding redundant computations. • Optimality: The algorithms are guaranteed to find optimal solutions to problems with optimal substructure. • Generality: Dynamic programming can be applied to a wide variety of problems. ADVANTAGES ADVANTAGES