For quite sometime Sudoku has become a one of the most enjoyable pass time for many people and they are visible every where. We are having daily Sudoku in newspaper, several online website where we can play Sudoku and several apps for hand held devices on android and Apple app store. In principle I knew how to solve a Sudoku and have tried several of them as well. But I wanted to code my thought process for a computer to do the job for me. Hence I ended up writing my own Sudoku solver.
The solver employs back tracking algorithm to solve a given Sudoku.
Moreover if the Sudoku is not a valid one or if it cannot be solved then
this programs reports that as well and exits. The idea of sharing this
post is to let the users understand how a back tracking algorithm works
and how it can be put in code using a stack. The pseudo code for the
algorithm is as below: