[43125 views]

**Problem Statement:** Place n-queens in n x n chessboard so that no two of them can attack each other i.e no two of them are on the same row, column or diagonal. In this problem backtracking is done to solve the problem. solutions of this problems are expressed in n-tuple.

In the above algorithm,

- For the n queen problem we take input of n, lets say n=4 so, k=1,2,3,4.
- For placing the first queen i.e k=1,we start a loop for n columns i.e n=4 so till the fourth column.
- The first queen can be placed at first column only.
- Then we move for the second queen and place it seeing that the first queen is not in the same column or in diagonal with the second queen.
- Similarly, the third queen and the fourth queen are placed. But if the fourth queen cannot be placed as it lies in same column or is in diagonal with other queens then back-tracking is done to the previous queens in order of 3,2,1 to achieve the unique feasible solution.
- For an n problem queen the same way all the n queens are placed and if the n
^{th}cannot be placed back-tracking is done and the queens are re-ordered and solution is obtained.

- Algorithm and Flowchart to display Floydâ€™s Triangle
- Algorithm and Flowchart to find all the Roots of a Quadratic Equation
- Algorithm and Flowchart to check whether a number is twisted prime or not
- Algorithm and flowchart to check whether a number is a Neon Number or not
- Algorithm and Flowchart for Armstrong Number

- Algorithm and Flowchart to find if a Number is Even or Odd
- Algorithm and Flowchart to find whether a number is Prime Number or Not
- Algorithm and Flowchart for Armstrong Number
- Algorithm for Finding Factorial of a Number
- Algorithm and Flowchart to Calculate Fibonacci series up to n
- How to round a number to nearest integer using python
- Can we have DB table without a primary key?
- Why does everyone hate Java?
- How much JavaScript to learn for Web Development
- How to store password like sensitive information in application