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.
Ad

Recommended

DYNAMIC_________________________PROGRAMMING.pptx
DYNAMIC_________________________PROGRAMMING.pptx
nazmusshakib335
 
6-Python-Recursion PPT.pptx
6-Python-Recursion PPT.pptx
Venkateswara Babu Ravipati
 
Lec-6 Recursion of Data Structures & Algorithms
Lec-6 Recursion of Data Structures & Algorithms
haseebanjum2611
 
Dynamic pgmming
Dynamic pgmming
Dr. C.V. Suresh Babu
 
Dynamic programming
Dynamic programming
Jay Nagar
 
Balaji-opt-lecture6-act.ppt
Balaji-opt-lecture6-act.ppt
JamesGreen666883
 
dynamic-programming
dynamic-programming
MuhammadSheraz836877
 
Dynamic programing
Dynamic programing
AniketSingh609353
 
Sure interview algorithm-1103
Sure interview algorithm-1103
Sure Interview
 
Dynamic Programming.pptx
Dynamic Programming.pptx
MuktarHossain13
 
Branch-and-Bound Technique for Solving Integer Programs
Branch-and-Bound Technique for Solving Integer Programs
R L
 
NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING
karishma gupta
 
Solving Optimization Problems using the Matlab Optimization.docx
Solving Optimization Problems using the Matlab Optimization.docx
whitneyleman54422
 
Balaji-opt-lecture5-linear program sp13.ppt
Balaji-opt-lecture5-linear program sp13.ppt
gokulkumaraguru8
 
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
Simplilearn
 
Algorithm_Dynamic Programming
Algorithm_Dynamic Programming
Im Rafid
 
Annotaed slides for dynamic programming algorithm
Annotaed slides for dynamic programming algorithm
johnathangamal27
 
Functions
Functions
acalomin
 
Algorithm review
Algorithm review
chidabdu
 
dynamic programming Rod cutting class
dynamic programming Rod cutting class
giridaroori
 
10 - Recursive.pptx
10 - Recursive.pptx
bernadusseno
 
lecture4-recursion.pptx
lecture4-recursion.pptx
Lizhen Shi
 
Introduction to TreeNet (2004)
Introduction to TreeNet (2004)
Salford Systems
 
Dynamic programming class 16
Dynamic programming class 16
Kumar
 
Skiena algorithm 2007 lecture16 introduction to dynamic programming
Skiena algorithm 2007 lecture16 introduction to dynamic programming
zukun
 
ERK_SRU_ch08-2019-03-27.ppt discussion in class room
ERK_SRU_ch08-2019-03-27.ppt discussion in class room
coolscools1231
 
Reading papers - survey on Non-Convex Optimization
Reading papers - survey on Non-Convex Optimization
X 37
 
Problem Understanding through Landscape Theory
Problem Understanding through Landscape Theory
jfrchicanog
 
Freequency Shift Keying in Digital to Analog Conversion
Freequency Shift Keying in Digital to Analog Conversion
AhsanRazaKolachi
 
What are Control Units in Computer Architecture
What are Control Units in Computer Architecture
AhsanRazaKolachi
 

More Related Content

Similar to Dynamic Programming Intro in Algorithm Design (20)

Sure interview algorithm-1103
Sure interview algorithm-1103
Sure Interview
 
Dynamic Programming.pptx
Dynamic Programming.pptx
MuktarHossain13
 
Branch-and-Bound Technique for Solving Integer Programs
Branch-and-Bound Technique for Solving Integer Programs
R L
 
NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING
karishma gupta
 
Solving Optimization Problems using the Matlab Optimization.docx
Solving Optimization Problems using the Matlab Optimization.docx
whitneyleman54422
 
Balaji-opt-lecture5-linear program sp13.ppt
Balaji-opt-lecture5-linear program sp13.ppt
gokulkumaraguru8
 
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
Simplilearn
 
Algorithm_Dynamic Programming
Algorithm_Dynamic Programming
Im Rafid
 
Annotaed slides for dynamic programming algorithm
Annotaed slides for dynamic programming algorithm
johnathangamal27
 
Functions
Functions
acalomin
 
Algorithm review
Algorithm review
chidabdu
 
dynamic programming Rod cutting class
dynamic programming Rod cutting class
giridaroori
 
10 - Recursive.pptx
10 - Recursive.pptx
bernadusseno
 
lecture4-recursion.pptx
lecture4-recursion.pptx
Lizhen Shi
 
Introduction to TreeNet (2004)
Introduction to TreeNet (2004)
Salford Systems
 
Dynamic programming class 16
Dynamic programming class 16
Kumar
 
Skiena algorithm 2007 lecture16 introduction to dynamic programming
Skiena algorithm 2007 lecture16 introduction to dynamic programming
zukun
 
ERK_SRU_ch08-2019-03-27.ppt discussion in class room
ERK_SRU_ch08-2019-03-27.ppt discussion in class room
coolscools1231
 
Reading papers - survey on Non-Convex Optimization
Reading papers - survey on Non-Convex Optimization
X 37
 
Problem Understanding through Landscape Theory
Problem Understanding through Landscape Theory
jfrchicanog
 
Sure interview algorithm-1103
Sure interview algorithm-1103
Sure Interview
 
Dynamic Programming.pptx
Dynamic Programming.pptx
MuktarHossain13
 
Branch-and-Bound Technique for Solving Integer Programs
Branch-and-Bound Technique for Solving Integer Programs
R L
 
NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING
karishma gupta
 
Solving Optimization Problems using the Matlab Optimization.docx
Solving Optimization Problems using the Matlab Optimization.docx
whitneyleman54422
 
Balaji-opt-lecture5-linear program sp13.ppt
Balaji-opt-lecture5-linear program sp13.ppt
gokulkumaraguru8
 
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
Simplilearn
 
Algorithm_Dynamic Programming
Algorithm_Dynamic Programming
Im Rafid
 
Annotaed slides for dynamic programming algorithm
Annotaed slides for dynamic programming algorithm
johnathangamal27
 
Algorithm review
Algorithm review
chidabdu
 
dynamic programming Rod cutting class
dynamic programming Rod cutting class
giridaroori
 
10 - Recursive.pptx
10 - Recursive.pptx
bernadusseno
 
lecture4-recursion.pptx
lecture4-recursion.pptx
Lizhen Shi
 
Introduction to TreeNet (2004)
Introduction to TreeNet (2004)
Salford Systems
 
Dynamic programming class 16
Dynamic programming class 16
Kumar
 
Skiena algorithm 2007 lecture16 introduction to dynamic programming
Skiena algorithm 2007 lecture16 introduction to dynamic programming
zukun
 
ERK_SRU_ch08-2019-03-27.ppt discussion in class room
ERK_SRU_ch08-2019-03-27.ppt discussion in class room
coolscools1231
 
Reading papers - survey on Non-Convex Optimization
Reading papers - survey on Non-Convex Optimization
X 37
 
Problem Understanding through Landscape Theory
Problem Understanding through Landscape Theory
jfrchicanog
 

More from AhsanRazaKolachi (20)

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

Recently uploaded (20)

Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Technologies
 
Software Testing & it’s types (DevOps)
Software Testing & it’s types (DevOps)
S Pranav (Deepu)
 
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Safe Software
 
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
Hassan Abid
 
Insurance Underwriting Software Enhancing Accuracy and Efficiency
Insurance Underwriting Software Enhancing Accuracy and Efficiency
Insurance Tech Services
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Advanced Token Development - Decentralized Innovation
Advanced Token Development - Decentralized Innovation
arohisinghas720
 
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
 
SAP Datasphere Catalog L2 (2024-02-07).pptx
SAP Datasphere Catalog L2 (2024-02-07).pptx
HimanshuSachdeva46
 
Migrating to Azure Cosmos DB the Right Way
Migrating to Azure Cosmos DB the Right Way
Alexander (Alex) Komyagin
 
Making significant Software Architecture decisions
Making significant Software Architecture decisions
Bert Jan Schrijver
 
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
Step by step guide to install Flutter and Dart
Step by step guide to install Flutter and Dart
S Pranav (Deepu)
 
OpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native Barcelona
Imma Valls Bernaus
 
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Technologies
 
Software Testing & it’s types (DevOps)
Software Testing & it’s types (DevOps)
S Pranav (Deepu)
 
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Safe Software
 
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
Hassan Abid
 
Insurance Underwriting Software Enhancing Accuracy and Efficiency
Insurance Underwriting Software Enhancing Accuracy and Efficiency
Insurance Tech Services
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Advanced Token Development - Decentralized Innovation
Advanced Token Development - Decentralized Innovation
arohisinghas720
 
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
 
SAP Datasphere Catalog L2 (2024-02-07).pptx
SAP Datasphere Catalog L2 (2024-02-07).pptx
HimanshuSachdeva46
 
Making significant Software Architecture decisions
Making significant Software Architecture decisions
Bert Jan Schrijver
 
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
Step by step guide to install Flutter and Dart
Step by step guide to install Flutter and Dart
S Pranav (Deepu)
 
OpenTelemetry 101 Cloud Native Barcelona
OpenTelemetry 101 Cloud Native Barcelona
Imma Valls Bernaus
 
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g
 
Ad

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