SlideShare a Scribd company logo
1 of 16
1
Summary: Design Methods
for Algorithms
Andreas Klappenecker
Design Methods
We have discussed examples of the
following algorithm design principles:
• Dynamic Programming Paradigm
• Greedy Paradigm
• Divide-and-Conquer Paradigm
2
Main Question
When can one successfully use one of
these algorithm design paradigms to solve
a problem?
3
Dynamic Programming
4
Dynamic Programming
The development of a dynamic programming algorithm
can be subdivided into the following steps:
1. Characterize the structure of an optimal solution
2. Recursively define the value of an optimal solution
3. Compute the value of an optimal solution in a
bottom-up fashion
4. Construct an optimal solution from computed
information
5
Key Question
• When can we apply the dynamic
programming paradigm?
6
Optimal Substructure
A problem exhibits optimal substructure
if and only if an optimal solution to the
problem contains within it optimal
solutions to subproblems.
Whenever a problem exhibits optimal
substructure, it is an indication that a dynamic
programming or greedy strategy might apply.
7
Overlapping Subproblems
A second indication that dynamic programming
might be applicable is that the space of
subproblems must be small, meaning that a
recursive algorithm for the problem solves the
same subproblems over and over.
Typically, the total number of distinct
subproblems is a polynomial in the input size.
8
Overlapping Subproblems
When a recursive algorithm revisits the
same problem over and over again, then
we say that the optimization problem has
overlapping subproblems.
Here two subproblems are called
overlapping if and only if they really are
the same subproblem that occurs as a
subproblem of different problems. 9
Note
If a recursive algorithm solving the
problem creates always new subproblems,
then this is an indication that divide-and-
conquer methods rather than dynamic
programming might apply.
10
Greedy Algorithms
11
Greedy Algorithms
The development of a greedy algorithm can be separated
into the following steps:
1. Cast the optimization problem as one in which we make
a choice and are left with one subproblem to solve.
2. Prove that there is always an optimal solution to the
original problem that makes the greedy choice, so
that the greedy choice is always safe.
3. Demonstrate that, having made the greedy choice,
what remains is a subproblem with the property that
if we combine an optimal solution to the subproblem
with the greedy choice that we have made, we arrive
at an optimal solution to the original problem. 12
Greedy-Choice Property
The greedy choice property is that a
globally optimal solution can be arrived at
by making a locally optimal (=greedy)
choice.
13
Optimal Substructure
A problem exhibits optimal substructure
if and only if an optimal solution to the
problem contains within it optimal
solutions to subproblems.
14
Divide-and-Conquer
15
Divide-and-Conquer
A divide and conquer method can be used for problems
that can be solved by recursively breaking them down
into two or more sub-problems of the same (or related)
type, until these become simple enough to be solved
directly. The solutions to the sub-problems are then
combined to give a solution to the original problem.
This approach is particularly successful when the
number of subproblems remain small in each step and
combining the solutions is easily done.
16

More Related Content

Similar to Design Methods for Algorithms

Algorithm and Complexity-Lesson 1.pptx
Algorithm and Complexity-Lesson 1.pptxAlgorithm and Complexity-Lesson 1.pptx
Algorithm and Complexity-Lesson 1.pptxApasra R
 
Types of Algorithms.ppt
Types of Algorithms.pptTypes of Algorithms.ppt
Types of Algorithms.pptALIZAIB KHAN
 
02 greedy, d&c, binary search
02 greedy, d&c, binary search02 greedy, d&c, binary search
02 greedy, d&c, binary searchPankaj Prateek
 
Introduction to dynamic programming
Introduction to dynamic programmingIntroduction to dynamic programming
Introduction to dynamic programmingAmisha Narsingani
 
CH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxCH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxsatvikkushwaha1
 
Algorithm paradigms
Algorithm paradigmsAlgorithm paradigms
Algorithm paradigmssuresh5c2
 
Search and Optimization Strategies
Search and Optimization StrategiesSearch and Optimization Strategies
Search and Optimization StrategiesFulvio Corno
 
Algorithms Design Patterns
Algorithms Design PatternsAlgorithms Design Patterns
Algorithms Design PatternsAshwin Shiv
 
Analysis and Design of Algorithms notes
Analysis and Design of Algorithms  notesAnalysis and Design of Algorithms  notes
Analysis and Design of Algorithms notesProf. Dr. K. Adisesha
 
Introduction to linear programming
Introduction to linear programmingIntroduction to linear programming
Introduction to linear programmingn_cool001
 
igor-kupczynski-msc-put-thesis
igor-kupczynski-msc-put-thesisigor-kupczynski-msc-put-thesis
igor-kupczynski-msc-put-thesisIgor Kupczyński
 
Finding Robust Solutions to Requirements Models
Finding Robust Solutions to Requirements ModelsFinding Robust Solutions to Requirements Models
Finding Robust Solutions to Requirements Modelsgregoryg
 

Similar to Design Methods for Algorithms (20)

Algorithm and Complexity-Lesson 1.pptx
Algorithm and Complexity-Lesson 1.pptxAlgorithm and Complexity-Lesson 1.pptx
Algorithm and Complexity-Lesson 1.pptx
 
algo classification.pptx
algo classification.pptxalgo classification.pptx
algo classification.pptx
 
Greedy Algoritham
Greedy AlgorithamGreedy Algoritham
Greedy Algoritham
 
Types of Algorithms.ppt
Types of Algorithms.pptTypes of Algorithms.ppt
Types of Algorithms.ppt
 
Greedymethod
GreedymethodGreedymethod
Greedymethod
 
02 greedy, d&c, binary search
02 greedy, d&c, binary search02 greedy, d&c, binary search
02 greedy, d&c, binary search
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
Introduction to dynamic programming
Introduction to dynamic programmingIntroduction to dynamic programming
Introduction to dynamic programming
 
CH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxCH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptx
 
Algorithm paradigms
Algorithm paradigmsAlgorithm paradigms
Algorithm paradigms
 
DAA UNIT 3
DAA UNIT 3DAA UNIT 3
DAA UNIT 3
 
Search and Optimization Strategies
Search and Optimization StrategiesSearch and Optimization Strategies
Search and Optimization Strategies
 
Algorithms Design Patterns
Algorithms Design PatternsAlgorithms Design Patterns
Algorithms Design Patterns
 
ADA Unit 2.pptx
ADA Unit 2.pptxADA Unit 2.pptx
ADA Unit 2.pptx
 
Analysis and Design of Algorithms notes
Analysis and Design of Algorithms  notesAnalysis and Design of Algorithms  notes
Analysis and Design of Algorithms notes
 
problem characterstics.pptx
problem characterstics.pptxproblem characterstics.pptx
problem characterstics.pptx
 
Introduction to linear programming
Introduction to linear programmingIntroduction to linear programming
Introduction to linear programming
 
igor-kupczynski-msc-put-thesis
igor-kupczynski-msc-put-thesisigor-kupczynski-msc-put-thesis
igor-kupczynski-msc-put-thesis
 
Algorithm.pptx
Algorithm.pptxAlgorithm.pptx
Algorithm.pptx
 
Finding Robust Solutions to Requirements Models
Finding Robust Solutions to Requirements ModelsFinding Robust Solutions to Requirements Models
Finding Robust Solutions to Requirements Models
 

More from JoshCasas1

Understanding Technologies In Education for the Third Quarter
Understanding Technologies In Education for the Third QuarterUnderstanding Technologies In Education for the Third Quarter
Understanding Technologies In Education for the Third QuarterJoshCasas1
 
MOST SUCCESSFUL ENTREPRENEURS PRESENTATION (1).pptx
MOST SUCCESSFUL ENTREPRENEURS PRESENTATION (1).pptxMOST SUCCESSFUL ENTREPRENEURS PRESENTATION (1).pptx
MOST SUCCESSFUL ENTREPRENEURS PRESENTATION (1).pptxJoshCasas1
 
Combined 2nd Section 4900 Slides.ppt
Combined 2nd Section 4900 Slides.pptCombined 2nd Section 4900 Slides.ppt
Combined 2nd Section 4900 Slides.pptJoshCasas1
 
270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.pptJoshCasas1
 
Chapters_1_2.ppt
Chapters_1_2.pptChapters_1_2.ppt
Chapters_1_2.pptJoshCasas1
 
JOSHUA A. CASAS (FILIPINO VALUES SYSTEM AND CHANGE).pptx
JOSHUA A. CASAS (FILIPINO VALUES SYSTEM AND CHANGE).pptxJOSHUA A. CASAS (FILIPINO VALUES SYSTEM AND CHANGE).pptx
JOSHUA A. CASAS (FILIPINO VALUES SYSTEM AND CHANGE).pptxJoshCasas1
 
L2 COMPUTER ETHICS PPT [Autosaved].pptx
L2 COMPUTER  ETHICS  PPT [Autosaved].pptxL2 COMPUTER  ETHICS  PPT [Autosaved].pptx
L2 COMPUTER ETHICS PPT [Autosaved].pptxJoshCasas1
 
Essential Access Exercises week 1-4.pdf
Essential Access Exercises week 1-4.pdfEssential Access Exercises week 1-4.pdf
Essential Access Exercises week 1-4.pdfJoshCasas1
 
MS ACCESS DEFINING DESIGN VIEW AND DATASHEET VIEW.ppt
MS ACCESS DEFINING DESIGN VIEW AND DATASHEET VIEW.pptMS ACCESS DEFINING DESIGN VIEW AND DATASHEET VIEW.ppt
MS ACCESS DEFINING DESIGN VIEW AND DATASHEET VIEW.pptJoshCasas1
 
M0DULE 1-MS ACCESS Databases and Database Objects.pdf
M0DULE 1-MS ACCESS Databases and Database Objects.pdfM0DULE 1-MS ACCESS Databases and Database Objects.pdf
M0DULE 1-MS ACCESS Databases and Database Objects.pdfJoshCasas1
 
Microsoft Access ppt.ppt
Microsoft Access ppt.pptMicrosoft Access ppt.ppt
Microsoft Access ppt.pptJoshCasas1
 
MICROSOFT ACCESS 2016Basics-Handouts and LESSON Introduction.pdf
MICROSOFT ACCESS 2016Basics-Handouts and LESSON Introduction.pdfMICROSOFT ACCESS 2016Basics-Handouts and LESSON Introduction.pdf
MICROSOFT ACCESS 2016Basics-Handouts and LESSON Introduction.pdfJoshCasas1
 
Introduction to Microsoft Access2.ppt
Introduction to Microsoft Access2.pptIntroduction to Microsoft Access2.ppt
Introduction to Microsoft Access2.pptJoshCasas1
 
LESSON 1- MICROSOFT ACCESS CREATING DATABASE.pdf
LESSON 1- MICROSOFT ACCESS CREATING DATABASE.pdfLESSON 1- MICROSOFT ACCESS CREATING DATABASE.pdf
LESSON 1- MICROSOFT ACCESS CREATING DATABASE.pdfJoshCasas1
 

More from JoshCasas1 (14)

Understanding Technologies In Education for the Third Quarter
Understanding Technologies In Education for the Third QuarterUnderstanding Technologies In Education for the Third Quarter
Understanding Technologies In Education for the Third Quarter
 
MOST SUCCESSFUL ENTREPRENEURS PRESENTATION (1).pptx
MOST SUCCESSFUL ENTREPRENEURS PRESENTATION (1).pptxMOST SUCCESSFUL ENTREPRENEURS PRESENTATION (1).pptx
MOST SUCCESSFUL ENTREPRENEURS PRESENTATION (1).pptx
 
Combined 2nd Section 4900 Slides.ppt
Combined 2nd Section 4900 Slides.pptCombined 2nd Section 4900 Slides.ppt
Combined 2nd Section 4900 Slides.ppt
 
270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt
 
Chapters_1_2.ppt
Chapters_1_2.pptChapters_1_2.ppt
Chapters_1_2.ppt
 
JOSHUA A. CASAS (FILIPINO VALUES SYSTEM AND CHANGE).pptx
JOSHUA A. CASAS (FILIPINO VALUES SYSTEM AND CHANGE).pptxJOSHUA A. CASAS (FILIPINO VALUES SYSTEM AND CHANGE).pptx
JOSHUA A. CASAS (FILIPINO VALUES SYSTEM AND CHANGE).pptx
 
L2 COMPUTER ETHICS PPT [Autosaved].pptx
L2 COMPUTER  ETHICS  PPT [Autosaved].pptxL2 COMPUTER  ETHICS  PPT [Autosaved].pptx
L2 COMPUTER ETHICS PPT [Autosaved].pptx
 
Essential Access Exercises week 1-4.pdf
Essential Access Exercises week 1-4.pdfEssential Access Exercises week 1-4.pdf
Essential Access Exercises week 1-4.pdf
 
MS ACCESS DEFINING DESIGN VIEW AND DATASHEET VIEW.ppt
MS ACCESS DEFINING DESIGN VIEW AND DATASHEET VIEW.pptMS ACCESS DEFINING DESIGN VIEW AND DATASHEET VIEW.ppt
MS ACCESS DEFINING DESIGN VIEW AND DATASHEET VIEW.ppt
 
M0DULE 1-MS ACCESS Databases and Database Objects.pdf
M0DULE 1-MS ACCESS Databases and Database Objects.pdfM0DULE 1-MS ACCESS Databases and Database Objects.pdf
M0DULE 1-MS ACCESS Databases and Database Objects.pdf
 
Microsoft Access ppt.ppt
Microsoft Access ppt.pptMicrosoft Access ppt.ppt
Microsoft Access ppt.ppt
 
MICROSOFT ACCESS 2016Basics-Handouts and LESSON Introduction.pdf
MICROSOFT ACCESS 2016Basics-Handouts and LESSON Introduction.pdfMICROSOFT ACCESS 2016Basics-Handouts and LESSON Introduction.pdf
MICROSOFT ACCESS 2016Basics-Handouts and LESSON Introduction.pdf
 
Introduction to Microsoft Access2.ppt
Introduction to Microsoft Access2.pptIntroduction to Microsoft Access2.ppt
Introduction to Microsoft Access2.ppt
 
LESSON 1- MICROSOFT ACCESS CREATING DATABASE.pdf
LESSON 1- MICROSOFT ACCESS CREATING DATABASE.pdfLESSON 1- MICROSOFT ACCESS CREATING DATABASE.pdf
LESSON 1- MICROSOFT ACCESS CREATING DATABASE.pdf
 

Recently uploaded

Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebJames Anderson
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...tanu pandey
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Onlineanilsa9823
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663Call Girls Mumbai
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 

Recently uploaded (20)

Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 

Design Methods for Algorithms

  • 1. 1 Summary: Design Methods for Algorithms Andreas Klappenecker
  • 2. Design Methods We have discussed examples of the following algorithm design principles: • Dynamic Programming Paradigm • Greedy Paradigm • Divide-and-Conquer Paradigm 2
  • 3. Main Question When can one successfully use one of these algorithm design paradigms to solve a problem? 3
  • 5. Dynamic Programming The development of a dynamic programming algorithm can be subdivided into the following steps: 1. Characterize the structure of an optimal solution 2. Recursively define the value of an optimal solution 3. Compute the value of an optimal solution in a bottom-up fashion 4. Construct an optimal solution from computed information 5
  • 6. Key Question • When can we apply the dynamic programming paradigm? 6
  • 7. Optimal Substructure A problem exhibits optimal substructure if and only if an optimal solution to the problem contains within it optimal solutions to subproblems. Whenever a problem exhibits optimal substructure, it is an indication that a dynamic programming or greedy strategy might apply. 7
  • 8. Overlapping Subproblems A second indication that dynamic programming might be applicable is that the space of subproblems must be small, meaning that a recursive algorithm for the problem solves the same subproblems over and over. Typically, the total number of distinct subproblems is a polynomial in the input size. 8
  • 9. Overlapping Subproblems When a recursive algorithm revisits the same problem over and over again, then we say that the optimization problem has overlapping subproblems. Here two subproblems are called overlapping if and only if they really are the same subproblem that occurs as a subproblem of different problems. 9
  • 10. Note If a recursive algorithm solving the problem creates always new subproblems, then this is an indication that divide-and- conquer methods rather than dynamic programming might apply. 10
  • 12. Greedy Algorithms The development of a greedy algorithm can be separated into the following steps: 1. Cast the optimization problem as one in which we make a choice and are left with one subproblem to solve. 2. Prove that there is always an optimal solution to the original problem that makes the greedy choice, so that the greedy choice is always safe. 3. Demonstrate that, having made the greedy choice, what remains is a subproblem with the property that if we combine an optimal solution to the subproblem with the greedy choice that we have made, we arrive at an optimal solution to the original problem. 12
  • 13. Greedy-Choice Property The greedy choice property is that a globally optimal solution can be arrived at by making a locally optimal (=greedy) choice. 13
  • 14. Optimal Substructure A problem exhibits optimal substructure if and only if an optimal solution to the problem contains within it optimal solutions to subproblems. 14
  • 16. Divide-and-Conquer A divide and conquer method can be used for problems that can be solved by recursively breaking them down into two or more sub-problems of the same (or related) type, until these become simple enough to be solved directly. The solutions to the sub-problems are then combined to give a solution to the original problem. This approach is particularly successful when the number of subproblems remain small in each step and combining the solutions is easily done. 16