Knuth Algorithm X: Selecting B,D & F over A

  • Thread starter Thread starter woundedtiger4
  • Start date Start date
  • Tags Tags
    Algorithm
Click For Summary
The discussion centers on the understanding of Knuth's Algorithm X, particularly regarding a specific example from the Wikipedia page. The main points include confusion about why row "A" is not part of the final solution, despite being selected initially, and why the branch containing row "D" was terminated unsuccessfully at Level 1. The algorithm aims to find a combination of rows that cover every number from 1 to 7 without repetition. Initially, row "A" is chosen for its abundance of numbers, but subsequent rows (B, C, E, and F) are eliminated due to overlapping numbers with "A." This leaves only row "D," which fails to provide a complete cover since it lacks the number '2' that is also missing from "A." Consequently, the algorithm terminates this branch and seeks alternative combinations. The explanation clarifies the reasoning behind the algorithm's decisions and the necessity for exact coverage.
woundedtiger4
Messages
188
Reaction score
0
Hi all, at http://en.wikipedia.org/wiki/Knuth's_Algorithm_X in the example I don't understand that why not "A" is in the final solution & only B, D & F are in the final solution whereas "A" was selected at Level 1
 
Technology news on Phys.org
[STRIKE]bump[/STRIKE]

plus why at the level 1 the branch containing "D" (i.e. containing 0, 1, 1, 1 in columns 2, 3, 5 & 6) was terminated unsuccessfully?
 
Last edited:
woundedtiger4 said:
Hi all, at http://en.wikipedia.org/wiki/Knuth's_Algorithm_X in the example I don't understand that why not "A" is in the final solution & only B, D & F are in the final solution whereas "A" was selected at Level 1

woundedtiger4 said:
[STRIKE]bump[/STRIKE]

plus why at the level 1 the branch containing "D" (i.e. containing 0, 1, 1, 1 in columns 2, 3, 5 & 6) was terminated unsuccessfully?

The intent, as far as I understand it, is to find a combination of rows that include every number from 1 to 7 but where each number only occurs in at most one row.

The algorithm seems to work by picking the row (A) that has the most numbers in it and then trying to find a combination of the other rows that have the numbers that aren't in A.

Having selected A (in this case), it proceeds by removing any sets that have a number in common with A (in this case, B,C,E and F). This is because any combination of B,C,E or F with A will have at least one multiple of '1', '4' or '7'. This only leaves row D as a possible match for A.

However, row D doesn't contain a '2' and neither does A, so the combination of A and D is not an exact cover, hence the algorithm terminates and goes to test for another combination.

NR
 
NemoReally said:
The intent, as far as I understand it, is to find a combination of rows that include every number from 1 to 7 but where each number only occurs in at most one row.

The algorithm seems to work by picking the row (A) that has the most numbers in it and then trying to find a combination of the other rows that have the numbers that aren't in A.

Having selected A (in this case), it proceeds by removing any sets that have a number in common with A (in this case, B,C,E and F). This is because any combination of B,C,E or F with A will have at least one multiple of '1', '4' or '7'. This only leaves row D as a possible match for A.

However, row D doesn't contain a '2' and neither does A, so the combination of A and D is not an exact cover, hence the algorithm terminates and goes to test for another combination.

NR

thank you sooooooooooo much, you really helped me in understanding it.
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
Replies
3
Views
1K
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 30 ·
2
Replies
30
Views
6K
  • · Replies 11 ·
Replies
11
Views
4K
Replies
29
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 25 ·
Replies
25
Views
3K
Replies
3
Views
4K