问题
how is Sudoku an np-complete problem? according to wiki, to be classed as an np-complete problem it must satisfy 2 conditions
- problem must be in np
- every other problem in np must be reducible to given problem in polynomial time
how is the second condition satisfied? can you give an example? for instance, I don't see any correlation between Sudoku problem and the travelling salesman problem or knapsack problem
(kindly forgive poor formatting as I'm typing this question on my mobile device)
回答1:
NP-completeness of SUDOKU notes in part:
This result was first shown in this master’s thesis by reduction from the NP-complete problem LATIN SQUARE COMPLETION. Sudoku wikipedia page.
Here is how it works (simplified, without reference to ASP-completeness, which I don’t cover in this course).
Suppose we have a n×n instance of LATIN SQUARE COMPLETION. We construct a n2×n2 instance of SUDOKU, that encodes the instance of LATIN SQUARE COMPLETION. Moreover, the encoding is very direct.
http://www-imai.is.s.u-tokyo.ac.jp/~yato/data2/MasterThesis.pdf being a link to the thesis in PDF.
来源:https://stackoverflow.com/questions/40390131/how-is-sudoku-np-complete