Skip to content

dianjin/sudoku-solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

sudoku-solver

A recursive backtracking sudoku solver written in C.

Folders

  • Bitwise - This algorithm uses bitwise operations and is much faster and smaller than the inefficient version.
  • Inefficient - This algorithm is loop heavy, and really slow compared to the bitwise version.

How the algorithm works

Both the bitwise and inefficient versions are recursive backtracking algorithms. This gif from wikimedia pretty much sums it up:

Other tips

  • This algo generates every possible Sudoku solution (there are 6.671*10^21) when you call the solve(Sudoku p) method on a 9x9 array of zeroes. Obviously, your computer won't be able to complete this operation since it could take decades.
  • Calling the solve function 100 million times takes 56 seconds in the inefficient version and 12 seconds in the inefficient version.

About

A recursive backtracking sudoku solver written in C.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages