This preview shows pages 1–9. Sign up to view the full content.
Backtracking
b
All the algorithm design techniques
discussed so far rely on the problem to
possess certain properties
– DivideandConquer
r
The problem is decomposable into smaller ones
r
Smaller problems can be solved
independently
r
Solution can be constructed by combining those of
smaller problems
r
L
R
x=r
x<r go left
x<r go right
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
– Greedy Method
r
Optimality and feasibility criteria
r
Criteria enable choices to be made
r
E.g., put in a knapsack objects of the largest profit to
weight ratio to maximize per unit volume profit
– Dynamic Programming
r
Principle of optimality
r
Problem is decomposable (subproblems need not be
independent)
r
Optimal solutions can be reused
b
Q: If a problem doesn’t have any of these
special characteristics?
b
Example: playing chess
– DivideandConquer:
r
Moves have to be provided step by step
r
Moves are interrelated
– Greedy method
r
Locally good moves are not necessarily globally good
– Dynamic Programming
r
Large solution space
r
Multiple optimal solutions
r
Principle of optimality (?)
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
b
GenerateandTest
paradigm
– Systematically generates possible solutions
(mostly end up in a
tree
structure)
r
Depth first (backtracking)
r
Breadth first
r
Best first (branchandbound)
– Systematically eliminates implausible solutions
as soon as identified
r
Feasibility
r
Optimality
r
Bounding is important for large problem size
b
Advantage
– general principle (graph or tree traversal)
– handle LARGE problem instances
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
N Queens
b
Input:
n
queens and a chess board of size
n
by
n
b
Output: a configuration where no two
queens can attack each other
b
DivideandConquer:
solutions are interdependent
• Greedy: backtracking may be
unavoidable
• DP: principle of optimality?
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
b
Generate
phase
:
use
explicit constraints
to
limit the size of the solution space
(
,
,
,
)
,
!
x
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 08/06/2008 for the course CS 130B taught by Professor Suri during the Winter '08 term at UCSB.
 Winter '08
 SURI
 Algorithms, Data Structures

Click to edit the document details