Skip to content

akshaybahadur21/NQueen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

NQueen ๐Ÿ‘ธ

This code helps you to understand the NQueen problem

Code Requirements ๐Ÿฆ„

The example code is in Java (version 1.8 or higher will work).

Description ๐Ÿฐ

The N queens puzzle is the problem of placing eight chess queens on an nร—n chessboard so that no two queens threaten each other. Thus, a solution requires that no two queens share the same row, column, or diagonal. Chess composer Max Bezzel published the eight queens puzzle in 1848. Franz Nauck published the first solutions in 1850.[2] Nauck also extended the puzzle to the n queens problem, with n queens on a chessboard of n ร— n squares.

Since then, many mathematicians, including Carl Friedrich Gauss, have worked on both the eight queens puzzle and its generalized n-queens version. In 1874, S. Gunther proposed a method using determinants to find solutions.[2] J.W.L. Glaisher refined Gunther's approach.

In 1972, Edsger Dijkstra used this problem to illustrate the power of what he called structured programming. He published a highly detailed description of a depth-first backtracking algorithm.

For more information, see

Results ๐Ÿ“Š

Execution ๐Ÿ‰

To compile the code, simply run the javac NQueen.java. To run the code, type java NQueen

javac NQueen.java
java NQueen