<s>
Algorithm	B-Algorithm
X	I-Algorithm
is	O
an	O
algorithm	O
for	O
solving	O
the	O
exact	O
cover	O
problem	O
.	O
</s>
<s>
It	O
is	O
a	O
straightforward	O
recursive	O
,	O
nondeterministic	O
,	O
depth-first	B-Algorithm
,	O
backtracking	B-Algorithm
algorithm	I-Algorithm
used	O
by	O
Donald	O
Knuth	O
to	O
demonstrate	O
an	O
efficient	O
implementation	O
called	O
DLX	O
,	O
which	O
uses	O
the	O
dancing	B-Algorithm
links	I-Algorithm
technique	O
.	O
</s>
<s>
The	O
exact	O
cover	O
problem	O
is	O
represented	O
in	O
Algorithm	B-Algorithm
X	I-Algorithm
by	O
a	O
matrix	O
A	O
consisting	O
of	O
0s	O
and	O
1s	O
.	O
</s>
<s>
Algorithm	B-Algorithm
X	I-Algorithm
works	O
as	O
follows	O
:	O
</s>
<s>
The	O
subalgorithms	O
form	O
a	O
search	B-Data_Structure
tree	I-Data_Structure
in	O
a	O
natural	O
way	O
,	O
with	O
the	O
original	O
problem	O
at	O
the	O
root	O
and	O
with	O
level	O
k	O
containing	O
each	O
subalgorithm	O
that	O
corresponds	O
to	O
k	O
chosen	O
rows	O
.	O
</s>
<s>
Backtracking	B-Algorithm
is	O
the	O
process	O
of	O
traversing	O
the	O
tree	O
in	O
preorder	O
,	O
depth	O
first	O
.	O
</s>
<s>
Algorithm	B-Algorithm
X	I-Algorithm
with	O
Knuth	O
's	O
suggested	O
heuristic	O
for	O
selecting	O
columns	O
solves	O
this	O
problem	O
as	O
follows	O
:	O
</s>
<s>
Column	O
1	O
is	O
the	O
first	O
column	O
with	O
two	O
1s	O
and	O
thus	O
is	O
selected	O
(	O
deterministically	B-General_Concept
)	O
:	O
</s>
<s>
Column	O
5	O
is	O
the	O
first	O
column	O
with	O
one	O
1	O
and	O
thus	O
is	O
selected	O
(	O
deterministically	B-General_Concept
)	O
:	O
</s>
<s>
Column	O
2	O
is	O
the	O
first	O
column	O
with	O
one	O
1	O
and	O
thus	O
is	O
selected	O
(	O
deterministically	B-General_Concept
)	O
.	O
</s>
<s>
Knuth	O
's	O
main	O
purpose	O
in	O
describing	O
Algorithm	B-Algorithm
X	I-Algorithm
was	O
to	O
demonstrate	O
the	O
utility	O
of	O
dancing	B-Algorithm
links	I-Algorithm
.	O
</s>
<s>
Knuth	O
showed	O
that	O
Algorithm	B-Algorithm
X	I-Algorithm
can	O
be	O
implemented	O
efficiently	O
on	O
a	O
computer	O
using	O
dancing	B-Algorithm
links	I-Algorithm
in	O
a	O
process	O
Knuth	O
calls	O
"	O
DLX	O
"	O
.	O
</s>
<s>
DLX	O
uses	O
the	O
matrix	O
representation	O
of	O
the	O
exact	O
cover	O
problem	O
,	O
implemented	O
as	O
doubly	B-Data_Structure
linked	I-Data_Structure
lists	I-Data_Structure
of	O
the	O
1s	O
of	O
the	O
matrix	O
:	O
each	O
1	O
element	O
has	O
a	O
link	O
to	O
the	O
next	O
1	O
above	O
,	O
below	O
,	O
to	O
the	O
left	O
,	O
and	O
to	O
the	O
right	O
of	O
itself	O
.	O
</s>
<s>
DLX	O
then	O
uses	O
dancing	B-Algorithm
links	I-Algorithm
to	O
quickly	O
select	O
permutations	O
of	O
rows	O
as	O
possible	O
solutions	O
and	O
to	O
efficiently	O
backtrack	O
(	O
undo	O
)	O
mistaken	O
guesses	O
.	O
</s>
