0% found this document useful (0 votes)
25 views

Backtracking

Uploaded by

Chetna Rai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Backtracking

Uploaded by

Chetna Rai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Baktracking

Brue fce Approach

B, B, 6,
(seah)
Stak Spoce Tree
3

BL B

6 wayo of gefig
and Girl
2 boyp
Seakd.
(on shain
Now, here not be middle
in
(ke
4 valid oluhong
So

rehn boak hom he slase


So, We
where he
Corshaint ailo.
Back tyackin alauy
Branch Dound
in
SQaie Space tree geneiadin
brnek boun d.

B
B devel
tuise
-ree
genenhor

N- Cueenn Problem

4 gueen (roblem
place 4 Zveens over
have to
We not a hack
Such hat do
chase board
are in atacking fosihora -
Yow
Nof Same
in Same column
Not in Same dogoral
fom
jalei We get optinal Brarch
dynamic frogrmming but king giveA all
and Backhac he conShains
& Bovnd Gllowing
fossibte
2 3
2

Column no
2

Ini hal çlak


Slace iee
generakd hap all

Jhe qveens rlacd


in diagl(ond, are
So, hence, 9vena
We moved 27d Under aHack)
yk
queen and
(olumn
o 3 (olunn,
queen
we just ensurel
kight oy,
Iniha(ly,
qvelns do not share Same
hat
row (ol nor
i)st in Same diagonel
fom
We get optnal Brareh
but
dyna mic Pregramming king givea
Backhac Jhe Conshains
al
& bund and
fossibte 6(owing
2 3
3

Column no
2

Inihal
sface tee
generakd hag all
Jhe qveens placd
/n diagoal (ond,
So, hence, 9vena are
we moved 3d Under athack)
queen
Column
qveen ho 2 column
Inihaly we just ensurel
Kight oe, çhare Sarne
hat qutns do notnot shave
Tow column
have
ger rakd a
Jhe shle space

This is he state space bree genern kd


of node Hhat wilC
Total no
|+3+ 4*3tm3a2 t 4*?n2a|
be geneakd =

yr fueen
probem
hrla is
n- gueen froblem,

(0

bounding
he Prcblen Burdirg hnch
Solwig Same row cd,
hncion
X'=2

2 2

X
3)
X 3
2

24 3
2

his s one
So(9
Arolher So(h iS

mirror image
3 2
3

2
3

The probem has wo sol


in he Same nanner,

You might also like