Content deleted Content added
No edit summary |
Use Knuth's more precise statement of algorithm |
||
Line 17:
Algorithm X functions as follows:
: If the matrix ''A'' is empty, the problem is solved; terminate successfully.
: Otherwise choose a column ''c'' ([[deterministic algorithm|deterministically]]).
: Choose a row ''r'' such that ''A''[''r'', ''c''] = 1 ([[nondeterministic algorithm|nondeterministically]]).
: Include row ''r'' in the partial solution.
: For each column ''j'' such that ''A''[''r'', ''j''] = 1,
# Repeat the algorithm on this reduced matrix.▼
:: delete column ''j'' from matrix ''A'';
:: for each row ''i'' such that ''A''[''i'', ''j''] = 1,
::: delete row ''i'' from matrix ''A''.
The example above is solved as follows, using 0 based notation:
|