Program to Check Whether a Number is Prime or Not
Prime Number A prime number can be divided, without a remainder, only by itself and by 1. For example, 13 can be divided only by 13 and by 1, so it is a prime number. In other words, When the only two factors of a number are 1 and the number, then it is a Prime […]
N Queen Problem Using Recursive Backtracking
N Queen Problem is the problem of placing N chess queens on an NxN chessboard so that no two queens attack each other, for which solutions exist for all natural numbers n except n=2 and n=3. A solution requires that no two queens share the same row, column, or diagonal. It is more general form of inital Eight queens problem, where we need to […]
Sudoku checker (By traversing each cell only once)
Sudoku is a logic-based combinatorial number-placement puzzle. Given a partially filled 9×9 2D array i.e. grid[9][9], the goal is to assign digits (from 1 to 9) to the empty cells so that every row, column, and subgrid of size 3×3 contains exactly one instance of the digits from 1 to 9. For Detailed understanding about Sudoku, […]
Sudoku Solver using Recursive Backtracking
Sudoku is a logic-based combinatorial number-placement puzzle. Given a partially filled 9×9 2D array grid[9][9], the goal is to assign digits (from 1 to 9) to the empty cells so that every row, column, and subgrid of size 3×3 contains exactly one instance of the digits from 1 to 9. For Detailed understanding about Sudoku, […]