SlideShare a Scribd company logo
3
Most read
4
Most read
7
Most read
DAA UNIT 2
BY:SURBHI SAROHA
SYLLABUS
• Dynamic programming
• Branch and bound algorithm
• Greedy algorithms
DYNAMIC PROGRAMMING
• The following are the steps that the dynamic programming follows:
• It breaks down the complex problem into simpler subproblems.
• It finds the optimal solution to these sub-problems.
• It stores the results of subproblems (memoization). The process of storing the results of subproblems is
known as memorization.
• It reuses them so that same sub-problem is calculated more than once.
• Finally, calculate the result of the complex problem.
CONT……
• Dynamic programming is a technique that breaks the problems into sub-problems, and saves the result
for future purposes so that we do not need to compute the result again.
• The subproblems are optimized to optimize the overall solution is known as optimal substructure
property.
• The main use of dynamic programming is to solve optimization problems.
• Here, optimization problems mean that when we are trying to find out the minimum or the maximum
solution of a problem.
• The dynamic programming guarantees to find the optimal solution of a problem if the solution exists.
APPLICATIONS OF DYNAMIC PROGRAMMING
APPROACH
• Matrix Chain Multiplication
• Longest Common Subsequence
• Travelling Salesman Problem
BRANCH AND BOUND ALGORITHM
• Branch and bound algorithms are used to find the optimal solution for combinatory, discrete, and
general mathematical optimization problems.
• In general, given an NP-Hard problem, a branch and bound algorithm explores the entire search
space of possible solutions and provides an optimal solution.
• A branch and bound algorithm consist of stepwise enumeration of possible candidate solutions by
exploring the entire search space. With all the possible solutions, we first build a rooted decision tree.
The root node represents the entire search space.
Dynamic programming, Branch and bound algorithm & Greedy algorithms
CONT…..
• Here, each child node is a partial solution and part of the solution set. Before constructing the rooted
decision tree, we set an upper and lower bound for a given problem based on the optimal solution. At
each level, we need to make a decision about which node to include in the solution set. At each level,
we explore the node with the best bound. In this way, we can find the best and optimal solution fast.
• Now it is crucial to find a good upper and lower bound in such cases. We can find an upper bound by
using any local optimization method or by picking any point in the search space. On the other hand, we
can obtain a lower bound from convex relaxation or duality.
• In general, we want to partition the solution set into smaller subsets of solution. Then we construct a
rooted decision tree, and finally, we choose the best possible subset (node) at each level to find the
best possible solution set.
GREEDY ALGORITHMS
• Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece
that offers the most obvious and immediate benefit. So the problems where choosing locally optimal also
leads to global solution are best fit for Greedy.
• For example consider the Fractional Knapsack Problem. The local optimal strategy is to choose the item that
has maximum value vs weight ratio. This strategy also leads to global optimal solution because we allowed to
take fractions of an item.
• A greedy algorithm is an approach for solving a problem by selecting the best option available at the moment.
It doesn't worry whether the current best result will bring the overall optimal result.
• The algorithm never reverses the earlier decision even if the choice is wrong. It works in a top-down approach.
• This algorithm may not produce the best result for all the problems. It's because it always goes for the local
best choice to produce the global best result.
Dynamic programming, Branch and bound algorithm & Greedy algorithms
ADVANTAGES OF GREEDY APPROACH
• The algorithm is easier to describe.
• This algorithm can perform better than other algorithms (but, not in all cases).
•
Drawback of Greedy Approach
• As mentioned earlier, the greedy algorithm doesn't always produce the optimal solution. This is the
major disadvantage of the algorithm
THANK YOU

More Related Content

PPT
Turing machines
PPT
Graph coloring problem
PPTX
Curve clipping
PPTX
0 1 knapsack using branch and bound
PPTX
Input-Buffering
PPT
Compiler Design
PPTX
Computability - Tractable, Intractable and Non-computable Function
PDF
Artificial Intelligence - Hill climbing.
Turing machines
Graph coloring problem
Curve clipping
0 1 knapsack using branch and bound
Input-Buffering
Compiler Design
Computability - Tractable, Intractable and Non-computable Function
Artificial Intelligence - Hill climbing.

What's hot (20)

PPTX
Travelling salesman dynamic programming
PPTX
Planning in Artificial Intelligence
PPTX
Types of Parser
PPTX
Loop optimization
PDF
UNIT-V.pdf daa unit material 5 th unit ppt
PPTX
Point to-point protocol (ppp)
PPTX
Syntax Analysis in Compiler Design
DOCX
Techniques & applications of Compiler
PPTX
Parity check(Error Detecting Codes)
PPTX
Distance Vector Routing Protocols
DOCX
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
PPTX
distributed memory architecture/ Non Shared MIMD Architecture
PDF
IP Datagram Structure
PDF
Syntax Directed Definition and its applications
PPTX
Three Address code
PPT
Real-Time Scheduling
PDF
Syntax analysis
PPTX
Associative memory 14208
PDF
A* Search Algorithm
PPTX
Passes of Compiler.pptx
Travelling salesman dynamic programming
Planning in Artificial Intelligence
Types of Parser
Loop optimization
UNIT-V.pdf daa unit material 5 th unit ppt
Point to-point protocol (ppp)
Syntax Analysis in Compiler Design
Techniques & applications of Compiler
Parity check(Error Detecting Codes)
Distance Vector Routing Protocols
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
distributed memory architecture/ Non Shared MIMD Architecture
IP Datagram Structure
Syntax Directed Definition and its applications
Three Address code
Real-Time Scheduling
Syntax analysis
Associative memory 14208
A* Search Algorithm
Passes of Compiler.pptx
Ad

Similar to Dynamic programming, Branch and bound algorithm & Greedy algorithms (20)

PDF
Unit 4 of design and analysis of algorithms
PPTX
esign and Analysis of Algorithms Presentation.pptx
PPTX
algo classification.pptx
PDF
heuristic search Techniques and game playing.pdf
PDF
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
PPTX
Greedy method class 11
PPTX
Greedy Method unit-2(Design and analysis of algorithms).pptx
PPT
Dynamic programming 2
PPTX
Introduction to the Greedy Algorithms - primer
PPTX
Introduction to dynamic programming
PPTX
Analysis and Design of Algorithms
PDF
Linear Models for Engineering applications
PDF
L21_L27_Unit_5_Dynamic_Programming Computer Science
PPTX
Module 2ppt.pptx divid and conquer method
PPTX
7. Algorithm Design and analysis ppt.pptx
PPTX
Greedy algorithm for design and analysis
PPTX
CH-1.1 Introduction (1).pptx
PPT
Greedy algorithm
PDF
Algo Strategies and explaination ppt.pdf
PPTX
Introduction to Dynamic Programming, Principle of Optimality
Unit 4 of design and analysis of algorithms
esign and Analysis of Algorithms Presentation.pptx
algo classification.pptx
heuristic search Techniques and game playing.pdf
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
Greedy method class 11
Greedy Method unit-2(Design and analysis of algorithms).pptx
Dynamic programming 2
Introduction to the Greedy Algorithms - primer
Introduction to dynamic programming
Analysis and Design of Algorithms
Linear Models for Engineering applications
L21_L27_Unit_5_Dynamic_Programming Computer Science
Module 2ppt.pptx divid and conquer method
7. Algorithm Design and analysis ppt.pptx
Greedy algorithm for design and analysis
CH-1.1 Introduction (1).pptx
Greedy algorithm
Algo Strategies and explaination ppt.pdf
Introduction to Dynamic Programming, Principle of Optimality
Ad

More from Dr. SURBHI SAROHA (20)

PPTX
Deep learning(UNIT 3) BY Ms SURBHI SAROHA
PPTX
MOBILE COMPUTING UNIT 2 by surbhi saroha
PPTX
Mobile Computing UNIT 1 by surbhi saroha
PPTX
DEEP LEARNING (UNIT 2 ) by surbhi saroha
PPTX
Introduction to Deep Leaning(UNIT 1).pptx
PPTX
Cloud Computing (Infrastructure as a Service)UNIT 2
PPTX
Management Information System(Unit 2).pptx
PPTX
Searching in Data Structure(Linear search and Binary search)
PPTX
Management Information System(UNIT 1).pptx
PPTX
Introduction to Cloud Computing(UNIT 1).pptx
PPTX
JAVA (UNIT 5)
PPTX
DBMS (UNIT 5)
PPTX
DBMS UNIT 4
PPTX
JAVA(UNIT 4)
PPTX
OOPs & C++(UNIT 5)
PPTX
OOPS & C++(UNIT 4)
PPTX
DBMS UNIT 3
PPTX
JAVA (UNIT 3)
PPTX
Keys in dbms(UNIT 2)
PPTX
DBMS (UNIT 2)
Deep learning(UNIT 3) BY Ms SURBHI SAROHA
MOBILE COMPUTING UNIT 2 by surbhi saroha
Mobile Computing UNIT 1 by surbhi saroha
DEEP LEARNING (UNIT 2 ) by surbhi saroha
Introduction to Deep Leaning(UNIT 1).pptx
Cloud Computing (Infrastructure as a Service)UNIT 2
Management Information System(Unit 2).pptx
Searching in Data Structure(Linear search and Binary search)
Management Information System(UNIT 1).pptx
Introduction to Cloud Computing(UNIT 1).pptx
JAVA (UNIT 5)
DBMS (UNIT 5)
DBMS UNIT 4
JAVA(UNIT 4)
OOPs & C++(UNIT 5)
OOPS & C++(UNIT 4)
DBMS UNIT 3
JAVA (UNIT 3)
Keys in dbms(UNIT 2)
DBMS (UNIT 2)

Recently uploaded (20)

PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Pre independence Education in Inndia.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
master seminar digital applications in india
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Final Presentation General Medicine 03-08-2024.pptx
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Microbial diseases, their pathogenesis and prophylaxis
STATICS OF THE RIGID BODIES Hibbelers.pdf
Supply Chain Operations Speaking Notes -ICLT Program
PPH.pptx obstetrics and gynecology in nursing
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
102 student loan defaulters named and shamed – Is someone you know on the list?
Pre independence Education in Inndia.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Pharmacology of Heart Failure /Pharmacotherapy of CHF
master seminar digital applications in india
Anesthesia in Laparoscopic Surgery in India
2.FourierTransform-ShortQuestionswithAnswers.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table

Dynamic programming, Branch and bound algorithm & Greedy algorithms

  • 2. SYLLABUS • Dynamic programming • Branch and bound algorithm • Greedy algorithms
  • 3. DYNAMIC PROGRAMMING • The following are the steps that the dynamic programming follows: • It breaks down the complex problem into simpler subproblems. • It finds the optimal solution to these sub-problems. • It stores the results of subproblems (memoization). The process of storing the results of subproblems is known as memorization. • It reuses them so that same sub-problem is calculated more than once. • Finally, calculate the result of the complex problem.
  • 4. CONT…… • Dynamic programming is a technique that breaks the problems into sub-problems, and saves the result for future purposes so that we do not need to compute the result again. • The subproblems are optimized to optimize the overall solution is known as optimal substructure property. • The main use of dynamic programming is to solve optimization problems. • Here, optimization problems mean that when we are trying to find out the minimum or the maximum solution of a problem. • The dynamic programming guarantees to find the optimal solution of a problem if the solution exists.
  • 5. APPLICATIONS OF DYNAMIC PROGRAMMING APPROACH • Matrix Chain Multiplication • Longest Common Subsequence • Travelling Salesman Problem
  • 6. BRANCH AND BOUND ALGORITHM • Branch and bound algorithms are used to find the optimal solution for combinatory, discrete, and general mathematical optimization problems. • In general, given an NP-Hard problem, a branch and bound algorithm explores the entire search space of possible solutions and provides an optimal solution. • A branch and bound algorithm consist of stepwise enumeration of possible candidate solutions by exploring the entire search space. With all the possible solutions, we first build a rooted decision tree. The root node represents the entire search space.
  • 8. CONT….. • Here, each child node is a partial solution and part of the solution set. Before constructing the rooted decision tree, we set an upper and lower bound for a given problem based on the optimal solution. At each level, we need to make a decision about which node to include in the solution set. At each level, we explore the node with the best bound. In this way, we can find the best and optimal solution fast. • Now it is crucial to find a good upper and lower bound in such cases. We can find an upper bound by using any local optimization method or by picking any point in the search space. On the other hand, we can obtain a lower bound from convex relaxation or duality. • In general, we want to partition the solution set into smaller subsets of solution. Then we construct a rooted decision tree, and finally, we choose the best possible subset (node) at each level to find the best possible solution set.
  • 9. GREEDY ALGORITHMS • Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit. So the problems where choosing locally optimal also leads to global solution are best fit for Greedy. • For example consider the Fractional Knapsack Problem. The local optimal strategy is to choose the item that has maximum value vs weight ratio. This strategy also leads to global optimal solution because we allowed to take fractions of an item. • A greedy algorithm is an approach for solving a problem by selecting the best option available at the moment. It doesn't worry whether the current best result will bring the overall optimal result. • The algorithm never reverses the earlier decision even if the choice is wrong. It works in a top-down approach. • This algorithm may not produce the best result for all the problems. It's because it always goes for the local best choice to produce the global best result.
  • 11. ADVANTAGES OF GREEDY APPROACH • The algorithm is easier to describe. • This algorithm can perform better than other algorithms (but, not in all cases). • Drawback of Greedy Approach • As mentioned earlier, the greedy algorithm doesn't always produce the optimal solution. This is the major disadvantage of the algorithm