Documente Academic
Documente Profesional
Documente Cultură
problem
Faculty Development Training
Programme
By,
Karpagalakshmi.R.C
Ap / CSE
TIET
Date : 14.12.2016
Backtracking
Backtracking
on
i
t
c
n
Ju
Portion B
Portion A
Backtracking
strategy
At
n
o
i
ct
n
Ju
Portion B
Portion A
One
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.
If
Ju
n
o
i
nc t
C
B
Find an arrangement of 8
queens on a single chess
board such that no two
queens are attacking one
another.
In
Q
Q
Continue
Animated Example:
http://www.hbmeyer.de/backtrac
k/achtdamen/eight.htm#up
perm[location] = i;
usedList[i] = true;
solveItRec(perm, location+1, usedList);
usedList[i] = false;
}
}
}
}
The
In
Backtracking optional
homework problem
Determine
References
Slides
images:
www.wikipedia.com
xkcd.com
Thank You