Content deleted Content added
Use Knuth's more precise statement of algorithm |
Use table, numbered items, and subscripts to better format algorithm specification |
||
Line 17:
Algorithm X functions as follows:
: If the matrix ''A'' is empty, the problem is solved; terminate successfully.▼
:{| border="1" cellpadding="5" cellspacing="0"
: Otherwise choose a column ''c'' ([[deterministic algorithm|deterministically]]).▼
|
: Choose a row ''r'' such that ''A''[''r'', ''c''] = 1 ([[nondeterministic algorithm|nondeterministically]]).▼
: For each column ''j'' such that ''A''[''r'', ''j''] = 1,▼
▲
:: delete column ''j'' from matrix ''A'';▼
#:
# Repeat this algorithm recursively on the reduced matrix ''A''.
|}
To reduce the number of iterations, [[Donald Knuth|Knuth]] suggests that the column choosing algorithm select a column with the lowest number of 1s in it.
|