Update Sudoku_Solver.java

pull/1005/head
Shawaiz Siddiqui 2022-10-12 12:50:36 +05:30 committed by GitHub
parent 07239d92b3
commit fe436f26a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -4,14 +4,16 @@
//THIS IS THE ALGORITHM USING BACKTRACKING FOR SOLVING SUDOKU.
// SUDOKU IS A VERY POPULAR PUZZLE GAME IN WHICH WE HAVE A 9X9 GRID IN WHICH WE HAVE TO FILL DIGITS (1-9) IN SUCH A MANNER THAT NO DIGIT IS REPEATED IN THE SAME ROW,
// OR IN THE SAME COLUMN OR THE INSIDE THE SMALL GRID ( THE SMALL GRID IS A 3x3 GRID, WHICH IS A PART OF THIS 9X9 GRID, THERE ARE SUCH 9 GRIDS IN THE BIGGER GRID).
// OR IN THE SAME COLUMN OR INSIDE THE SMALL GRID ( THE SMALL GRID IS A 3x3 GRID, WHICH IS A PART OF THIS 9X9 GRID, THERE ARE SUCH 9 GRIDS IN THE BIGGER GRID).
// SO OUR TASK IS TO FILL THE NUMBERS IN THE BLANK SPACES (SOME SPACES WILL ALREADY BE FILLED WHICH CAN'T BE CHANGED), SUCH THAT IT MATCHES ALL THE CONDITIONS. WE USE
// BACKTRACKING ALGORITHM HERE, WHICH SOLVES THIS PROBLEM IN VARIOUS HIT AND TRIALS AND FINALLY GIVES THE OUTPUT AS THE RESULTANT SOLUTION.
//(NOTE: BLANK CELLS ARE FILLED WITH ZEROS)
//*****************ALGORITHM INFORMATION******************\\
// Time complexity: O (9^ (n*n)). For every unassigned index, there are 9 possible options so the time complexity is O (9^ (n*n))
// Time complexity: O (9^(N x N)). For every unassigned index, there are 9 possible options so the time complexity is O (9^ (n*n))
// Space complexity: O(N x N) as it only operates on (N x N) grid
//*********************************************************\\