MakarovSuites
English
EnglishDeutschРусскийУкраїнськаFrançaisEspañolItalianoPolski
Contact & licences

Math

Backtracking: queens and sudoku

Follow recursive backtracking for N queens and full 9×9 Sudoku, compare pruning and variable ordering, and enumerate queen solutions.

Backtracking: queens and sudoku — Actual application image
Actual application image

Try this

Watch choices, rejected branches and retreats in a real recursive search. Queens exclude shared columns and diagonals. Sudoku uses row, column and 3×3 constraints; MRV chooses the most constrained empty cell.

Equations used in the module
Equations
Queens: qᵢ ≠ qⱼ and |qᵢ−qⱼ| ≠ |i−j|
Sudoku: every row, column and 3×3 box contains 1…9
Backtracking explores a partial assignment, then undoes it
MRV chooses an unfilled variable with the fewest legal values

Related experiments

Back to catalogue
Edit distance and diff — Actual application image

Math

Edit distance and diff

Build edit-distance tables from your own strings and trace an optimal alignment with adjustable substitution cost.

Mazes: generate and solve — Actual application image

Math

Mazes: generate and solve

Generate mazes with depth-first carving, Prim and Wilson, then compare breadth-first, A* and wall-following routes.