Link Details

Link 110895 thumbnail
User 252611 avatar

By Thierry.Lefort
via exampledepot.com
Published: Sep 06 2008 / 11:43

The Sudoku puzzle consists of a grid of 9x9 cells. This 81-cell grid is further subdivided into nine subgrids of 3x3 cells. A few of the cells are filled with a single digit between 1 and 9 (the givens). To solve the puzzle, the empty cells must be filled in such a way that every 9-cell row, column, and subgrid contains each of the digits between 1 and 9.
  • 16
  • 0
  • 1770
  • 516

Comments

Add your comment
User 172008 avatar

Daniel Dyer replied ago:

0 votes Vote down Vote up Reply

How fast is this approach?

User 49399 avatar

jf110361 replied ago:

1 votes Vote down Vote up Reply

On my 2.6GHz Intel Core 2 Duo iMac, it takes 30 milliseconds. A similar Perl script (but one that doesn't detect unsolvable or multiple solution problems) takes 1 millisecond. The only thing slow about Sudoku is humans (either inputting the puzzle or solving it).

User 172008 avatar

Daniel Dyer replied ago:

0 votes Vote down Vote up Reply

Thanks, sounds plenty fast enough. I was just wondering how it would compare to the dancing links algorithm (http://en.wikipedia.org/wiki/Dancing_Links) that seems to be preferred by some Sudoku solvers.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.