Algorithms_in_C 1.0.0
Set of algorithms implemented in C.
|
Sudoku Solver using recursive implementation of brute-force algorithm. More...
#include <assert.h>
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Data Structures | |
struct | sudoku |
Structure to hold the matrix and dimensions. More... | |
Functions | |
bool | OKrow (const struct sudoku *a, int x, int y, int v) |
Check if x ^th row is valid. | |
bool | OKcol (const struct sudoku *a, int x, int y, int v) |
Check if y ^th column is valid. | |
bool | OKbox (const struct sudoku *a, int x, int y, int v) |
Check if a 3x3 box is valid. | |
bool | OK (const struct sudoku *a, int x, int y, int v) |
Check if element v is valid to place at (x,y) location. | |
void | print (const struct sudoku *a) |
Print the matrix to stdout. | |
bool | get_next_unknown (const struct sudoku *a, int *x, int *y) |
Find and get the location for next empty cell. | |
bool | solve (struct sudoku *a) |
Function to solve a partially filled sudoku matrix. | |
void | test () |
int | main () |
Main function. | |
Sudoku Solver using recursive implementation of brute-force algorithm.
Given an incomplete N*N Sudoku and asked to solve it using the following recursive algorithm:
int main | ( | void | ) |
Main function.
void test | ( | void | ) |