Can you place N queens on a board with N columns and N rows so no two queens threaten each other? The 8 queens problem on a chessboard is a special case. Prof. Devadas describes a general solution to the N queens problem that uses recursive backtracking search.
Puzzle Description
Python Code
Assignment
- Do one or more of the exercises in A Profusion of Queens puzzle.
Solution
Programming Constructs and Algorithmic Paradigms Covered in this Puzzle
- Recursive procedures
- Exhaustive search through recursion