If there are no unallocated cells, then the Sudoku is already solved.We are going to solve our Sudoku in a similar way. In backtracking, we first start with a sub-solution and if this sub-solution doesn't give us a correct final answer, then we just come back and change our sub-solution. Any 3x3 sub-matrix has the same number more than once.Any column contains the same number more than once.Any row contains the same number more than once.Thus, we can also conclude that a Sudoku is considered wrongly filled if it satisfies any of these criteria: You can see that every row, column, and sub-matrix (3x3) contains each digit from 1 to 9. For example, a Sudoku problem is given below. We are provided with a partially filled 9x9 matrix and have to fill every remaining cell in it. Sudoku is a 9x9 matrix filled with numbers 1 to 9 in such a way that every row, column and sub-matrix (3x3) has each of the digits from 1 to 9. If you don't know about backtracking, then just brush through the previous post. In this post, I will introduce a Sudoku-solving algorithm using backtracking.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |