SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Backtracking
&
Branch and Bound
Backtracking
• Suppose you have to make a series of
decisions, among various choices, where
– You don’t have enough information to know
what to choose
– Each decision leads to a new set of choices
– Some sequence of choices (possibly more than
one) may be a solution to your problem

• Backtracking is a methodical way of trying
out various sequences of decisions, until
you find one that “works”
Backtracking Algorithm
•
•

Based on depth-first recursive search
Approach
1. Tests whether solution has been found
2. If found solution, return it
3. Else for each choice that can be made
a) Make that choice
b) Recur
c) If recursion returns a solution, return it

4. If no choices remain, return failure

•

Some times called “search tree”
Backtracking
• Performs a depth-first traversal of a tree
• Continues until it reaches a node that is nonviable or non-promising
• Prunes the sub tree rooted at this node and
continues the depth-first traversal of the tree
Backtracking Algorithm – Example
• Find path through maze
– Start at beginning of maze
– If at exit, return true
– Else for each step from current location
• Recursively find path
• Return with first successful step
• Return false if all steps fail
Backtracking
• Backtracking is a technique used to solve
problems with a large search space, by
systematically trying and eliminating possibilities.
• A standard example of backtracking would be
going through a maze.

Portion B

– At some point in a maze, you might have two options
of which direction to go:
Portion A
Backtracking


One strategy would be
to try going through
Portion A of the maze.



If you get stuck before
you find your way out,
then you "backtrack" to
the junction.

At this point in time you
know that Portion A will
NOT lead you out of the
maze,


so you then start
searching in Portion B

Portion A



Portion B
Backtracking
• Clearly, at a single junction
you could have even more
than 2 choices.
• The backtracking strategy
says to try each choice, one
after the other,
– if you ever get stuck,
"backtrack" to the junction
and try the next choice.

C
B

A

• If you try all choices and
never found a way out,
then there IS no solution to
the maze.
Backtracking – Eight Queens
Problem

• Find an arrangement of 8
queens on a single chess board
such that no two queens are
attacking one another.
• In chess, queens can move all
the way down any row, column
or diagonal (so long as no
pieces are in the way).

– Due to the first two restrictions,
it's clear that each row and
column of the board will have
exactly one queen.
Backtracking – Eight Queens
Problem

• The backtracking strategy is as
follows:
1)

Q

Q

Place a queen on the first
available square in row 1.

2)

Move onto the next row,
placing a queen on the first
available square there (that
doesn't conflict with the
previously placed queens).

3)

Q
Q
Q

Q

Continue…

Continue in this fashion until
either:
a)
b)

you have solved the problem, or
you get stuck.
–

When you get stuck, remove the
queens that got you there, until you
get to a row where there is another
valid square to try.

Animated Example:
http://www.hbmeyer.de/backtrack
/achtdamen/eight.htm#up
Backtracking – Eight Queens Problem
• When we carry out backtracking, an easy
way to visualize what is going on is a tree
that shows all the different possibilities
that have been tried.
• On the board we will show a visual
representation of solving the 4 Queens
problem (placing 4 queens on a 4x4 board
where no two attack one another).
Backtracking – Eight Queens Problem
• The neat thing about coding up backtracking,
is that it can be done recursively, without
having to do all the bookkeeping at once.
– Instead, the stack or recursive calls does most of
the bookkeeping
– (ie, keeping track of which queens we've placed,
and which combinations we've tried so far, etc.)
perm[] - stores a valid permutation of queens from index 0 to location-1.
location – the column we are placing the next queen
usedList[] – keeps track of the rows in which the queens have already been placed.

void solveItRec(int perm[], int location, struct onesquare usedList[]) {
if (location == SIZE) {
printSol(perm);
}
for (int i=0; i<SIZE; i++) {
if (usedList[i] == false) {
if (!conflict(perm, location, i)) {

Found a solution to the problem, so print it!
Loop through possible rows to place this queen.
Only try this row if it hasn’t been used
Check if this position conflicts with any previous
queens on the diagonal

perm[location] = i;
usedList[i] = true;
solveItRec(perm, location+1, usedList);
usedList[i] = false;

}
}
}
}

1) mark the queen in this row
2) mark the row as used
3) solve the next column location
recursively
4) un-mark the row as used, so we
can get ALL possible valid
solutions.
Backtracking – 8 queens problem - Analysis
• Another possible brute-force algorithm is generate the
permutations of the numbers 1 through 8 (of which there are 8! =
40,320),
– and uses the elements of each permutation as indices to place a
queen on each row.
– Then it rejects those boards with diagonal attacking positions.

• The backtracking algorithm, is a slight improvement on the
permutation method,
– constructs the search tree by considering one row of the board at a
time, eliminating most non-solution board positions at a very early
stage in their construction.
– Because it rejects row and diagonal attacks even on incomplete
boards, it examines only 15,720 possible queen placements.

• A further improvement which examines only 5,508 possible queen
placements is to combine the permutation based method with the
early pruning method:
– The permutations are generated depth-first, and the search space is
pruned if the partial permutation produces a diagonal attack
Sudoku and Backtracking
• Another common puzzle that can be solved by backtracking
is a Sudoku puzzle.
• The basic idea behind the solution is as follows:
1)
2)
3)
4)

Scan the board to look for an empty square that could take on
the fewest possible values based on the simple game
constraints.
If you find a square that can only be one possible value, fill it in
with that one value and continue the algorithm.
If no such square exists, place one of the possible numbers for
that square in the number and repeat the process.
If you ever get stuck, erase the last number placed and see if
there are other possible choices for that slot and try those
next.
Mazes and Backtracking
• A final example of something that can be solved
using backtracking is a maze.
– From your start point, you will iterate through each
possible starting move.
– From there, you recursively move forward.
– If you ever get stuck, the recursion takes you back to
where you were, and you try the next possible move.

• In dealing with a maze, to make sure you don't try
too many possibilities,
– one should mark which locations in the maze have been
visited already so that no location in the maze gets
visited twice.
– (If a place has already been visited, there is no point in
trying to reach the end of the maze from there again.
Example: N-Queens Problem
• Given an N x N sized chess board
• Objective: Place N queens on the
board so that no queens are in
danger
• One option would be to generate a tree of
every possible board layout
• This would be an expensive way to find a
solution
Backtracking
• Backtracking prunes
entire sub trees if their
root node is not a viable
solution
• The algorithm will
“backtrack” up the tree
to search for other
possible solutions
Efficiency of Backtracking
• This given a significant advantage over an
exhaustive search of the tree for the average
problem
• Worst case: Algorithm tries every path,
traversing the entire search space as in an
exhaustive search
Branch and Bound
• Where backtracking uses a depth-first search
with pruning, the branch and bound algorithm
uses a breadth-first search with pruning
• Branch and bound uses a queue as an
auxiliary data structure
The Branch and Bound Algorithm
• Starting by considering the root node and
applying a lower-bounding and upperbounding procedure to it
• If the bounds match, then an optimal
solution has been found and the algorithm
is finished
• If they do not match, then algorithm runs
on the child nodes
Example:
The Traveling Salesman Problem
 Branch and bound can be used to solve the TSP using
a priority queue as an auxiliary data structure
 An example is the problem with a directed graph
given by this adjacency matrix:
Traveling Salesman Problem
• The problem starts at vertex 1
• The initial bound for the minimum tour is the
sum of the minimum outgoing edges from
each vertex
Vertex 1
Vertex 2
Vertex 3
Vertex 4
Vertex 5
Bound

min (14, 4, 10, 20)
min (14, 7, 8, 7)
min (4, 5, 7, 16)
min (11, 7, 9, 2)
min (18, 7, 17, 4)

=
=
=
=
=

4
7
4
2
4

= 21
Traveling Salesman Problem
• Next, the bound for the node for the partial
tour from 1 to 2 is calculated using the
formula:
Bound = Length from 1 to 2 + sum of min outgoing
edges for vertices 2 to 5 = 14 + (7 + 4 + 2 + 4) = 31
Traveling Salesman Problem
• The node is added to the priority queue
• The node with the lowest bound is then
removed
• This calculation for the bound for the node of
the partial tours is repeated on this node
• The process ends when the priority queue is
empty
Traveling Salesman Problem
• The final results of
this example are in
this tree:
• The accompanying
number for each node
is the order it was
removed in
Efficiency of Branch and Bound
• In many types of problems, branch and bound
is faster than branching, due to the use of a
breadth-first search instead of a depth-first
search
• The worst case scenario is the same, as it will
still visit every node in the tree

Weitere ähnliche Inhalte

Was ist angesagt?

Backtracking
Backtracking  Backtracking
Backtracking Vikas Sharma
 
The n Queen Problem
The n Queen ProblemThe n Queen Problem
The n Queen ProblemSukrit Gupta
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmGaurav Kolekar
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithmSrikrishnan Suresh
 
Heuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.pptHeuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.pptkarthikaparthasarath
 
b+ tree
b+ treeb+ tree
b+ treebitistu
 
unit-4-dynamic programming
unit-4-dynamic programmingunit-4-dynamic programming
unit-4-dynamic programminghodcsencet
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back trackingTech_MX
 
Greedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemGreedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemMadhu Bala
 
B trees in Data Structure
B trees in Data StructureB trees in Data Structure
B trees in Data StructureAnuj Modi
 
AI Lecture 4 (informed search and exploration)
AI Lecture 4 (informed search and exploration)AI Lecture 4 (informed search and exploration)
AI Lecture 4 (informed search and exploration)Tajim Md. Niamat Ullah Akhund
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithmssandeep54552
 
Binary tree
Binary treeBinary tree
Binary treeRajendran
 
State Space Representation and Search
State Space Representation and SearchState Space Representation and Search
State Space Representation and SearchHitesh Mohapatra
 
2.2 decision tree
2.2 decision tree2.2 decision tree
2.2 decision treeKrish_ver2
 
Introduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in LogicIntroduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in LogicVishal Tandel
 

Was ist angesagt? (20)

Backtracking
Backtracking  Backtracking
Backtracking
 
The n Queen Problem
The n Queen ProblemThe n Queen Problem
The n Queen Problem
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithm
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
 
AI: AI & Problem Solving
AI: AI & Problem SolvingAI: AI & Problem Solving
AI: AI & Problem Solving
 
Heuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.pptHeuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.ppt
 
Sum of subset problem.pptx
Sum of subset problem.pptxSum of subset problem.pptx
Sum of subset problem.pptx
 
b+ tree
b+ treeb+ tree
b+ tree
 
unit-4-dynamic programming
unit-4-dynamic programmingunit-4-dynamic programming
unit-4-dynamic programming
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
 
AI Lecture 3 (solving problems by searching)
AI Lecture 3 (solving problems by searching)AI Lecture 3 (solving problems by searching)
AI Lecture 3 (solving problems by searching)
 
Greedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemGreedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack Problem
 
B trees in Data Structure
B trees in Data StructureB trees in Data Structure
B trees in Data Structure
 
AI Lecture 4 (informed search and exploration)
AI Lecture 4 (informed search and exploration)AI Lecture 4 (informed search and exploration)
AI Lecture 4 (informed search and exploration)
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
Hill climbing
Hill climbingHill climbing
Hill climbing
 
Binary tree
Binary treeBinary tree
Binary tree
 
State Space Representation and Search
State Space Representation and SearchState Space Representation and Search
State Space Representation and Search
 
2.2 decision tree
2.2 decision tree2.2 decision tree
2.2 decision tree
 
Introduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in LogicIntroduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in Logic
 

Andere mochten auch

Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound techniqueishmecse13
 
Branch and bound
Branch and boundBranch and bound
Branch and boundNv Thejaswini
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound techniqueishmecse13
 
backtracking algorithms of ada
backtracking algorithms of adabacktracking algorithms of ada
backtracking algorithms of adaSahil Kumar
 
Knapsack Problem
Knapsack ProblemKnapsack Problem
Knapsack ProblemJenny Galino
 
Branch and bound
Branch and boundBranch and bound
Branch and boundAcad
 
Algorithm chapter 11
Algorithm chapter 11Algorithm chapter 11
Algorithm chapter 11chidabdu
 
01 knapsack using backtracking
01 knapsack using backtracking01 knapsack using backtracking
01 knapsack using backtrackingmandlapure
 
Analysis of Feature Selection Algorithms (Branch & Bound and Beam search)
Analysis of Feature Selection Algorithms (Branch & Bound and Beam search)Analysis of Feature Selection Algorithms (Branch & Bound and Beam search)
Analysis of Feature Selection Algorithms (Branch & Bound and Beam search)Parinda Rajapaksha
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of AlgorithmsArvind Krishnaa
 
Branch and bound
Branch and boundBranch and bound
Branch and boundMyrian Santos
 
Subset sum problem Dynamic and Brute Force Approch
Subset sum problem Dynamic and Brute Force ApprochSubset sum problem Dynamic and Brute Force Approch
Subset sum problem Dynamic and Brute Force ApprochIjlal Ijlal
 
Backtracking
BacktrackingBacktracking
BacktrackingSally Salem
 
Backtracking
BacktrackingBacktracking
BacktrackingVikas Sharma
 
Queue- 8 Queen
Queue- 8 QueenQueue- 8 Queen
Queue- 8 QueenHa Ninh
 

Andere mochten auch (20)

Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Branch and bounding : Data structures
Branch and bounding : Data structuresBranch and bounding : Data structures
Branch and bounding : Data structures
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
 
backtracking algorithms of ada
backtracking algorithms of adabacktracking algorithms of ada
backtracking algorithms of ada
 
Knapsack Problem
Knapsack ProblemKnapsack Problem
Knapsack Problem
 
Branch & bound
Branch & boundBranch & bound
Branch & bound
 
Tsp branch and-bound
Tsp branch and-boundTsp branch and-bound
Tsp branch and-bound
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Algorithm chapter 11
Algorithm chapter 11Algorithm chapter 11
Algorithm chapter 11
 
01 knapsack using backtracking
01 knapsack using backtracking01 knapsack using backtracking
01 knapsack using backtracking
 
Analysis of Feature Selection Algorithms (Branch & Bound and Beam search)
Analysis of Feature Selection Algorithms (Branch & Bound and Beam search)Analysis of Feature Selection Algorithms (Branch & Bound and Beam search)
Analysis of Feature Selection Algorithms (Branch & Bound and Beam search)
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of Algorithms
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Subset sum problem Dynamic and Brute Force Approch
Subset sum problem Dynamic and Brute Force ApprochSubset sum problem Dynamic and Brute Force Approch
Subset sum problem Dynamic and Brute Force Approch
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Queue- 8 Queen
Queue- 8 QueenQueue- 8 Queen
Queue- 8 Queen
 

Ähnlich wie Back tracking and branch and bound class 20

Backtracking Basics.pptx
Backtracking Basics.pptxBacktracking Basics.pptx
Backtracking Basics.pptxsunidhi740916
 
module5_backtrackingnbranchnbound_2022.pdf
module5_backtrackingnbranchnbound_2022.pdfmodule5_backtrackingnbranchnbound_2022.pdf
module5_backtrackingnbranchnbound_2022.pdfShiwani Gupta
 
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycleBacktracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cyclevarun arora
 
8 QUEENS PROBLEM.pptx
8 QUEENS PROBLEM.pptx8 QUEENS PROBLEM.pptx
8 QUEENS PROBLEM.pptxsunidhi740916
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesFahim Ferdous
 
Sudoku
SudokuSudoku
SudokuYara Ali
 
Types Of Recursion in C++, Data Stuctures by DHEERAJ KATARIA
Types Of Recursion in C++, Data Stuctures by DHEERAJ KATARIATypes Of Recursion in C++, Data Stuctures by DHEERAJ KATARIA
Types Of Recursion in C++, Data Stuctures by DHEERAJ KATARIADheeraj Kataria
 
Backtracking Algorithm.pptx
Backtracking Algorithm.pptxBacktracking Algorithm.pptx
Backtracking Algorithm.pptxsangeeta194160
 
Backtrack search-algorithm
Backtrack search-algorithmBacktrack search-algorithm
Backtrack search-algorithmRuchika Sinha
 
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptxbcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptxB.T.L.I.T
 
8-Queens Problem.pptx
8-Queens Problem.pptx8-Queens Problem.pptx
8-Queens Problem.pptxrajinooka
 
Chap 4 local_search
Chap 4 local_search Chap 4 local_search
Chap 4 local_search Rakhi Gupta
 
Sudoku solver
Sudoku solverSudoku solver
Sudoku solverPankti Fadia
 
Data Analysis and Algorithms Lecture 1: Introduction
 Data Analysis and Algorithms Lecture 1: Introduction Data Analysis and Algorithms Lecture 1: Introduction
Data Analysis and Algorithms Lecture 1: IntroductionTayyabSattar5
 
Undecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation AlgorithmsUndecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation AlgorithmsMuthu Vinayagam
 
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWERUndecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWERmuthukrishnavinayaga
 
(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 ai(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 aiRadhika Srinivasan
 

Ähnlich wie Back tracking and branch and bound class 20 (20)

Backtracking Basics.pptx
Backtracking Basics.pptxBacktracking Basics.pptx
Backtracking Basics.pptx
 
module5_backtrackingnbranchnbound_2022.pdf
module5_backtrackingnbranchnbound_2022.pdfmodule5_backtrackingnbranchnbound_2022.pdf
module5_backtrackingnbranchnbound_2022.pdf
 
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycleBacktracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
 
8 QUEENS PROBLEM.pptx
8 QUEENS PROBLEM.pptx8 QUEENS PROBLEM.pptx
8 QUEENS PROBLEM.pptx
 
Backtracking
BacktrackingBacktracking
Backtracking
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
 
Back tracking
Back trackingBack tracking
Back tracking
 
Sudoku
SudokuSudoku
Sudoku
 
Types Of Recursion in C++, Data Stuctures by DHEERAJ KATARIA
Types Of Recursion in C++, Data Stuctures by DHEERAJ KATARIATypes Of Recursion in C++, Data Stuctures by DHEERAJ KATARIA
Types Of Recursion in C++, Data Stuctures by DHEERAJ KATARIA
 
Backtracking Algorithm.pptx
Backtracking Algorithm.pptxBacktracking Algorithm.pptx
Backtracking Algorithm.pptx
 
02LocalSearch.pdf
02LocalSearch.pdf02LocalSearch.pdf
02LocalSearch.pdf
 
Backtrack search-algorithm
Backtrack search-algorithmBacktrack search-algorithm
Backtrack search-algorithm
 
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptxbcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
 
8-Queens Problem.pptx
8-Queens Problem.pptx8-Queens Problem.pptx
8-Queens Problem.pptx
 
Chap 4 local_search
Chap 4 local_search Chap 4 local_search
Chap 4 local_search
 
Sudoku solver
Sudoku solverSudoku solver
Sudoku solver
 
Data Analysis and Algorithms Lecture 1: Introduction
 Data Analysis and Algorithms Lecture 1: Introduction Data Analysis and Algorithms Lecture 1: Introduction
Data Analysis and Algorithms Lecture 1: Introduction
 
Undecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation AlgorithmsUndecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation Algorithms
 
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWERUndecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
 
(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 ai(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 ai
 

Mehr von Kumar

Graphics devices
Graphics devicesGraphics devices
Graphics devicesKumar
 
Fill area algorithms
Fill area algorithmsFill area algorithms
Fill area algorithmsKumar
 
region-filling
region-fillingregion-filling
region-fillingKumar
 
Bresenham derivation
Bresenham derivationBresenham derivation
Bresenham derivationKumar
 
Bresenham circles and polygons derication
Bresenham circles and polygons dericationBresenham circles and polygons derication
Bresenham circles and polygons dericationKumar
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xsltKumar
 
Extracting data from xml
Extracting data from xmlExtracting data from xml
Extracting data from xmlKumar
 
Xml basics
Xml basicsXml basics
Xml basicsKumar
 
XML Schema
XML SchemaXML Schema
XML SchemaKumar
 
Publishing xml
Publishing xmlPublishing xml
Publishing xmlKumar
 
DTD
DTDDTD
DTDKumar
 
Applying xml
Applying xmlApplying xml
Applying xmlKumar
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XMLKumar
 
How to deploy a j2ee application
How to deploy a j2ee applicationHow to deploy a j2ee application
How to deploy a j2ee applicationKumar
 
JNDI, JMS, JPA, XML
JNDI, JMS, JPA, XMLJNDI, JMS, JPA, XML
JNDI, JMS, JPA, XMLKumar
 
EJB Fundmentals
EJB FundmentalsEJB Fundmentals
EJB FundmentalsKumar
 
JSP and struts programming
JSP and struts programmingJSP and struts programming
JSP and struts programmingKumar
 
java servlet and servlet programming
java servlet and servlet programmingjava servlet and servlet programming
java servlet and servlet programmingKumar
 
Introduction to JDBC and JDBC Drivers
Introduction to JDBC and JDBC DriversIntroduction to JDBC and JDBC Drivers
Introduction to JDBC and JDBC DriversKumar
 
Introduction to J2EE
Introduction to J2EEIntroduction to J2EE
Introduction to J2EEKumar
 

Mehr von Kumar (20)

Graphics devices
Graphics devicesGraphics devices
Graphics devices
 
Fill area algorithms
Fill area algorithmsFill area algorithms
Fill area algorithms
 
region-filling
region-fillingregion-filling
region-filling
 
Bresenham derivation
Bresenham derivationBresenham derivation
Bresenham derivation
 
Bresenham circles and polygons derication
Bresenham circles and polygons dericationBresenham circles and polygons derication
Bresenham circles and polygons derication
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xslt
 
Extracting data from xml
Extracting data from xmlExtracting data from xml
Extracting data from xml
 
Xml basics
Xml basicsXml basics
Xml basics
 
XML Schema
XML SchemaXML Schema
XML Schema
 
Publishing xml
Publishing xmlPublishing xml
Publishing xml
 
DTD
DTDDTD
DTD
 
Applying xml
Applying xmlApplying xml
Applying xml
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
How to deploy a j2ee application
How to deploy a j2ee applicationHow to deploy a j2ee application
How to deploy a j2ee application
 
JNDI, JMS, JPA, XML
JNDI, JMS, JPA, XMLJNDI, JMS, JPA, XML
JNDI, JMS, JPA, XML
 
EJB Fundmentals
EJB FundmentalsEJB Fundmentals
EJB Fundmentals
 
JSP and struts programming
JSP and struts programmingJSP and struts programming
JSP and struts programming
 
java servlet and servlet programming
java servlet and servlet programmingjava servlet and servlet programming
java servlet and servlet programming
 
Introduction to JDBC and JDBC Drivers
Introduction to JDBC and JDBC DriversIntroduction to JDBC and JDBC Drivers
Introduction to JDBC and JDBC Drivers
 
Introduction to J2EE
Introduction to J2EEIntroduction to J2EE
Introduction to J2EE
 

KĂźrzlich hochgeladen

MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A BeĂąa
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A BeĂąa
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 

KĂźrzlich hochgeladen (20)

Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 

Back tracking and branch and bound class 20

  • 2. Backtracking • Suppose you have to make a series of decisions, among various choices, where – You don’t have enough information to know what to choose – Each decision leads to a new set of choices – Some sequence of choices (possibly more than one) may be a solution to your problem • Backtracking is a methodical way of trying out various sequences of decisions, until you find one that “works”
  • 3. Backtracking Algorithm • • Based on depth-first recursive search Approach 1. Tests whether solution has been found 2. If found solution, return it 3. Else for each choice that can be made a) Make that choice b) Recur c) If recursion returns a solution, return it 4. If no choices remain, return failure • Some times called “search tree”
  • 4. Backtracking • Performs a depth-first traversal of a tree • Continues until it reaches a node that is nonviable or non-promising • Prunes the sub tree rooted at this node and continues the depth-first traversal of the tree
  • 5. Backtracking Algorithm – Example • Find path through maze – Start at beginning of maze – If at exit, return true – Else for each step from current location • Recursively find path • Return with first successful step • Return false if all steps fail
  • 6. Backtracking • Backtracking is a technique used to solve problems with a large search space, by systematically trying and eliminating possibilities. • A standard example of backtracking would be going through a maze. Portion B – At some point in a maze, you might have two options of which direction to go: Portion A
  • 7. Backtracking  One strategy would be to try going through Portion A of the maze.  If you get stuck before you find your way out, then you "backtrack" to the junction. At this point in time you know that Portion A will NOT lead you out of the maze,  so you then start searching in Portion B Portion A  Portion B
  • 8. Backtracking • Clearly, at a single junction you could have even more than 2 choices. • The backtracking strategy says to try each choice, one after the other, – if you ever get stuck, "backtrack" to the junction and try the next choice. C B A • If you try all choices and never found a way out, then there IS no solution to the maze.
  • 9. Backtracking – Eight Queens Problem • Find an arrangement of 8 queens on a single chess board such that no two queens are attacking one another. • In chess, queens can move all the way down any row, column or diagonal (so long as no pieces are in the way). – Due to the first two restrictions, it's clear that each row and column of the board will have exactly one queen.
  • 10. Backtracking – Eight Queens Problem • The backtracking strategy is as follows: 1) Q Q Place a queen on the first available square in row 1. 2) Move onto the next row, placing a queen on the first available square there (that doesn't conflict with the previously placed queens). 3) Q Q Q Q Continue… Continue in this fashion until either: a) b) you have solved the problem, or you get stuck. – When you get stuck, remove the queens that got you there, until you get to a row where there is another valid square to try. Animated Example: http://www.hbmeyer.de/backtrack /achtdamen/eight.htm#up
  • 11. Backtracking – Eight Queens Problem • When we carry out backtracking, an easy way to visualize what is going on is a tree that shows all the different possibilities that have been tried. • On the board we will show a visual representation of solving the 4 Queens problem (placing 4 queens on a 4x4 board where no two attack one another).
  • 12. Backtracking – Eight Queens Problem • The neat thing about coding up backtracking, is that it can be done recursively, without having to do all the bookkeeping at once. – Instead, the stack or recursive calls does most of the bookkeeping – (ie, keeping track of which queens we've placed, and which combinations we've tried so far, etc.)
  • 13. perm[] - stores a valid permutation of queens from index 0 to location-1. location – the column we are placing the next queen usedList[] – keeps track of the rows in which the queens have already been placed. void solveItRec(int perm[], int location, struct onesquare usedList[]) { if (location == SIZE) { printSol(perm); } for (int i=0; i<SIZE; i++) { if (usedList[i] == false) { if (!conflict(perm, location, i)) { Found a solution to the problem, so print it! Loop through possible rows to place this queen. Only try this row if it hasn’t been used Check if this position conflicts with any previous queens on the diagonal perm[location] = i; usedList[i] = true; solveItRec(perm, location+1, usedList); usedList[i] = false; } } } } 1) mark the queen in this row 2) mark the row as used 3) solve the next column location recursively 4) un-mark the row as used, so we can get ALL possible valid solutions.
  • 14. Backtracking – 8 queens problem - Analysis • Another possible brute-force algorithm is generate the permutations of the numbers 1 through 8 (of which there are 8! = 40,320), – and uses the elements of each permutation as indices to place a queen on each row. – Then it rejects those boards with diagonal attacking positions. • The backtracking algorithm, is a slight improvement on the permutation method, – constructs the search tree by considering one row of the board at a time, eliminating most non-solution board positions at a very early stage in their construction. – Because it rejects row and diagonal attacks even on incomplete boards, it examines only 15,720 possible queen placements. • A further improvement which examines only 5,508 possible queen placements is to combine the permutation based method with the early pruning method: – The permutations are generated depth-first, and the search space is pruned if the partial permutation produces a diagonal attack
  • 15. Sudoku and Backtracking • Another common puzzle that can be solved by backtracking is a Sudoku puzzle. • The basic idea behind the solution is as follows: 1) 2) 3) 4) Scan the board to look for an empty square that could take on the fewest possible values based on the simple game constraints. If you find a square that can only be one possible value, fill it in with that one value and continue the algorithm. If no such square exists, place one of the possible numbers for that square in the number and repeat the process. If you ever get stuck, erase the last number placed and see if there are other possible choices for that slot and try those next.
  • 16. Mazes and Backtracking • A final example of something that can be solved using backtracking is a maze. – From your start point, you will iterate through each possible starting move. – From there, you recursively move forward. – If you ever get stuck, the recursion takes you back to where you were, and you try the next possible move. • In dealing with a maze, to make sure you don't try too many possibilities, – one should mark which locations in the maze have been visited already so that no location in the maze gets visited twice. – (If a place has already been visited, there is no point in trying to reach the end of the maze from there again.
  • 17. Example: N-Queens Problem • Given an N x N sized chess board • Objective: Place N queens on the board so that no queens are in danger
  • 18. • One option would be to generate a tree of every possible board layout • This would be an expensive way to find a solution
  • 19. Backtracking • Backtracking prunes entire sub trees if their root node is not a viable solution • The algorithm will “backtrack” up the tree to search for other possible solutions
  • 20. Efficiency of Backtracking • This given a significant advantage over an exhaustive search of the tree for the average problem • Worst case: Algorithm tries every path, traversing the entire search space as in an exhaustive search
  • 21. Branch and Bound • Where backtracking uses a depth-first search with pruning, the branch and bound algorithm uses a breadth-first search with pruning • Branch and bound uses a queue as an auxiliary data structure
  • 22. The Branch and Bound Algorithm • Starting by considering the root node and applying a lower-bounding and upperbounding procedure to it • If the bounds match, then an optimal solution has been found and the algorithm is finished • If they do not match, then algorithm runs on the child nodes
  • 23. Example: The Traveling Salesman Problem  Branch and bound can be used to solve the TSP using a priority queue as an auxiliary data structure  An example is the problem with a directed graph given by this adjacency matrix:
  • 24. Traveling Salesman Problem • The problem starts at vertex 1 • The initial bound for the minimum tour is the sum of the minimum outgoing edges from each vertex Vertex 1 Vertex 2 Vertex 3 Vertex 4 Vertex 5 Bound min (14, 4, 10, 20) min (14, 7, 8, 7) min (4, 5, 7, 16) min (11, 7, 9, 2) min (18, 7, 17, 4) = = = = = 4 7 4 2 4 = 21
  • 25. Traveling Salesman Problem • Next, the bound for the node for the partial tour from 1 to 2 is calculated using the formula: Bound = Length from 1 to 2 + sum of min outgoing edges for vertices 2 to 5 = 14 + (7 + 4 + 2 + 4) = 31
  • 26. Traveling Salesman Problem • The node is added to the priority queue • The node with the lowest bound is then removed • This calculation for the bound for the node of the partial tours is repeated on this node • The process ends when the priority queue is empty
  • 27. Traveling Salesman Problem • The final results of this example are in this tree: • The accompanying number for each node is the order it was removed in
  • 28. Efficiency of Branch and Bound • In many types of problems, branch and bound is faster than branching, due to the use of a breadth-first search instead of a depth-first search • The worst case scenario is the same, as it will still visit every node in the tree