Class ChessQueensAll
java.lang.Object
topics.backtracking.ChessQueensAll
BACKTRACKING PROBLEM: THE PROBLEM OF THE N QUEENS
This program calculates one way of placing
n queens on a chessboard of side n
- Author:
- vicegd
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbacktracking(int j) Performs the backtracking processintGets the number of solutions after the backtracking process
-
Constructor Details
-
ChessQueensAll
public ChessQueensAll(int n) Constructor for ChessQueensAll objects- Parameters:
n- Size of the board
-
-
Method Details
-
backtracking
public void backtracking(int j) Performs the backtracking process- Parameters:
j- Level in the tree of states starting at 0
-
getNumberOfSolutions
public int getNumberOfSolutions()Gets the number of solutions after the backtracking process- Returns:
- Number of solutions
-