Comparison of Brute Force, Backtracking and Branch & Bound Approaches
1. Brute Force Approach
• Brute force generates and checks all possible solutions.
• No pruning or intelligence is used.
• Example: TSP checks all possible tours and selects the minimum cost tour.
• Time complexity can be very high: O(n!).
2. Backtracking Approach
• Backtracking improves brute force by cutting off branches that cannot lead to a valid solution.
• It builds solutions step-by-step and checks whether the partial solution is promising.
• If not promising, it backtracks.
• Examples: N-Queens, Sum of Subsets, Graph Coloring, Hamiltonian Cycle.
3. Branch and Bound Approach
• Branch and Bound is mainly used for optimization problems.
• It divides the problem into subproblems and calculates bounds.
• Branches are pruned if they cannot improve the current best solution.
• Maximization uses Upper Bound and Minimization uses Lower Bound.
• Example: 0/1 Knapsack and TSP.
Comparison Table
Feature
Main idea
Brute Force
Try all solutions
Backtracking
Branch & Bound
Remove invalid
Remove non-optimal
solutions
solutions
Pruning
No
Feasibility based
Bound based
Problem type
Any
Constraint problems
Optimization problems
Bound function
No
No
Yes
Search
Complete exploration
DFS
DFS/BFS/Best-first
Summary
• Brute Force: Try all possibilities.
• Backtracking: Stop when a solution becomes impossible.
• Branch and Bound: Stop when a solution cannot become better than the current best.
Relationship:
Backtracking is an improved form of brute force.
Branch and Bound is an optimization-based form of state-space search.