-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocumentation.txt
39 lines (30 loc) · 1.36 KB
/
documentation.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Sudoku Solver
Solves n*n Grid where n>=3.
Algorithm
-> In phase one, locked all single values if any by intersecting row and columns possible values Starting with set that has lowest preemptive set.
-> If all cells are filled, then print output
-> Else try solving it by selecting a value from the subset obtained from possiblevalueList remaining cells.
-> If solution found print it
-> Else print no Solution
P.S Most of Easy and Medium problems will be solved by first phase.
Data Structures
-> Used priority to get cell with possible values
-> A List to maintain preemptive values of each row and column
-> A Two dimensional array to store the board
Restrictions
- Only Grid with valid inputs will be allowed
- '.' should not be given in symbols list
Packages & class
* Default
Main.java: Has main method implementation.
* Sudoku
handler.java: Has the implementation of sudoku solution
Methods
* runSolver #sudoku.handler
Does all required initialization and invokes the solution methods.
* trySolveByLocking #sudoku.handler
Has the implementation of locking single value.
* tryRandomChoice #sudoku.handler
Selects and assign a value that doesn't violate the sudoku rule from possible list to reach solution
References
1. Crook, J.F.. (2009). A pencil-and-paper algorithm for solving Sudoku puzzles. Notices of the American Mathematical Society. 56.