Recursive algorithms that employ the backtracking technique. Developed as an exercise on backtracking and recursion.
queens.c: Algorithm that solves the N-Queens problem. The problem consists of placing N queens on an NxN sized chess board such as that no queen threatens another queen. In other words, every row, column and diagonal needs a single queen. The algorithm takes as input a single integer number, which is the size of the board, and outputs one of the possible solutions or a message if no solutions are possible. In order to make the program output every possible consistent board configuration, modify the queen function in the first conditional statement, such as that passing the test makes it output the matrix at that point and return 0 instead of one.
sudoku.c: Algorithm to solve sudoku puzzles for the traditional sudoku rules. The sudoku board is a 9x9 board divided into 9 3x3 squares. The rules for the puzzle are that every row, column and 3x3 box contains the numbers 1 to 9, and no digit repeats within the same column, row or box. The algorithm takes as input a 9x9 integer matrix, and outputs the solved board, or a message if the puzzle is impossible. In case there is not an unique solution and you wish to see all possible solutions, changes are to be made in a similar fashion as described above for the N-Queens function, on the sudoku function.