Sudoku backtracking algorithm

后端 未结 6 1957
感动是毒
感动是毒 2020-12-03 03:55

First of all, I\'ll state that this is a university assignment so I\'m not asking for someone to write the code for me I just need to be pointed in the right direction. :)

6条回答
  •  温柔的废话
    2020-12-03 04:51

    You're algorithm looks fine. The problem is that you are using a brute-force approach, and therefore your running time is (number of characters)^(size of board) - so for 9x9 there are 9^9=387420489 and for 16x16 the running time is 16^16=18446744073709551616. you can see the difference.

    Try finding a Dynamic programing approach

    • If you are a first\second year student, just stay with what you have (and check correctness). Your teacher won't expect more.

提交回复
热议问题