Coders Packet


By Alankrita Singh

A given Sudoku problem in solved in C++ language using the backtracking algorithm provided that the solution exists for problem entered in the program.

Here a sudoku problem is solved using a backtracking algorithm in C++.

size is a global variable given a constant value 9.

integer variable r represents the row and c represents the column.

sudoku[size][size] is a 2D array in which the sudoku problem is stored.

The printsolution function is used to print the sudoku solution if the solution exists for the particular problem.

The vacant function finds if there is any vacant place in the 9X9 grid.

checkRow checks if a number passed to the function is present in all the rows.

The same is applies to the checkCol function for all the columns.

checkBox checks if the passed number to the function is present in all of the 9, 3X3 grid.

solution function is used for solving the sudoku problem.


Download project

Reviews Report

Submitted by Alankrita Singh (alankrita2420)

Download packets of source code on Coders Packet