BACKTRACKING
AND
BRANCH & BOUND:
WHERE AND WHEN TO USE.
-Baiamonlang Pohthmi(ADTU/0/2023-26/BCAO/005)
-Aron Joti Chakma(ADTU/0/2023-26/BCAO/032)
Introduction to Backtracking
Systematic Exploration Depth-First Search Example
Trial-and-error approach to Explores full search space, Solves N-Queens by placing
build solutions recursively. backtracks on invalid states. queens without conflicts.
When to Use Backtracking
Use Cases
• Find all solutions or configurations
• Strong constraints that reject partial invalid solutions early
• Examples: Sudoku solvers, maze pathfinding
Introduction to Branch
and Bound
Optimization Focus Flexible Search
Prunes search using Can be breadth-first or
bounding functions to best-first exploring
estimate costs. promising solutions first.
Example
Solves knapsack problem by pruning suboptimal branches early.
When to Use Branch & Bound
Use Cases
• Find optimal solution in large search spaces
• Use cost functions to guide pruning
• Examples: Traveling Salesman, assignment problems
Key Differences:
Backtracking vs.
Branch & Bound
Backtracking Branch & Bound
Finds all solutions Finds optimal solution
Depth-first search Breadth or best-first search
Prunes by constraints Prunes by bounding functions
Summary: Choosing the Right Approach
Hybrid Approach
Branch & Bound
Combine them for complex
Backtracking
Optimal for cost-guided, large scenarios needing flexibility.
Best for all solutions and strong optimization problems.
constraints.
THANK YOU