Sudoku Solvable?
Is it possible to check whether a sudoku is solvable or not. I recently tried leetcode-36. But it only checks if the sudoku was valid, but i want to check for its solvability.
I designed a algorithm using backtracking, it checks for its validity and then solves the sudoku. For example if I gave sudoku that is unsolvable but is valid, it would check all 9^81 possibilities and then conclude it is not solvable. 9^81 is a huge number and my taking lots of time to give the result that sudoku is unsolvable.
For example check this sudoku, which is valid but unsolvable.
I want to know whether there is any algorithm that checks for sudoku to be solvable, or any such optimizations in backtracking that can be made to solve this issue.
Why is random order slow in my Sudoku backtracking solving algorithm compared to “in order”
When running my sudoku backtracking algorithm using random ordering for finding new available locations, it takes way longer than when finding the available locations, left to right, top to bottom. Why? How should I change the code to have quick random ordering?