Professional Documents
Culture Documents
BACKTRACKING
2 MARKS QUESTIONS
1) What is Backtracking?
A. As the name suggests we backtrack to find the solution. We start with one possible move
out of many available moves and try to solve the problem.If we are able to solve the problem
with the selected move,then we will print the solution else we will backtrack and select some
other move and try to solve it. If none if the moves work out we will claim that there is no
solution for the problem.
Example: N-Queens problem
2) Write a generalised algorithm for Backtracking?
A) Pick a starting point
while (Problem is not solved)
For each path from the starting point
check if selected path is safe
and make recursive call to the rest of the problem.
If recursive calls returns true, then return true.
else undo the current move and return false.
End For
If none of the move works out, return False ,NO SOLUTION.
3) What are explicit constraints in Backtracking?
A. These are the rules which restrict each xi to take on the values from a given set
Example: In N-Queens problem the N-Queens can be placed in nxn chessboard.
4) What are implicit constraints in Backtracking?
A. These are the rules which of the tuples in the solution space satisfy the criterion function.
Example: In N-Queens problem implicit constraints are no two queens placed in same
row same column and diagonal
.
problem is the number of sources is equal to the number of destinations .It is explained in the
following way.
1. Only one job is assigned to person.
2. Each person is assigned with exactly one job.
Ex: A manager has five persons for five separate jobs and the cost of assigning each job to
each person is given. His goal is to assign one and only job to each person in such a way that
the total cost of assignment is minimized.
12) What are the types in Assignment problems?
A. The Assignment problem is of further two types
1. Balanced Assignment problem(sources=destinations)
2. Unbalanced Assignment problem(sources destinations). So, here a dummy source or
destination is created. Dummy variable have zero cost.
16) Why assignment problem and TSP are applications of Branch and Bound?
17) To which problems Branch and Bound is applicable and why?