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. More... | |
bool | OKcol (const struct sudoku *a, int x, int y, int v) |
Check if y ^th column is valid. More... | |
bool | OKbox (const struct sudoku *a, int x, int y, int v) |
Check if a 3x3 box is valid. More... | |
bool | OK (const struct sudoku *a, int x, int y, int v) |
Check if element v is valid to place at (x,y) location. More... | |
void | print (const struct sudoku *a) |
Print the matrix to stdout. More... | |
bool | get_next_unknown (const struct sudoku *a, int *x, int *y) |
Find and get the location for next empty cell. More... | |
bool | solve (struct sudoku *a) |
Function to solve a partially filled sudoku matrix. More... | |
void | test () |
int | main () |
Main function. More... | |
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 | ) |