N Queen Problem

96 views 14 slides Jan 10, 2023
Slide 1
Slide 1 of 14
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14

About This Presentation

The N Queen is the problem of placing N chess queens on an N×N chessboard so that no two queens attack each other.


Slide Content

N-Queen Problem

Presented By
1.Piyush Nitnaware
2.Divyanshu Bisen
3.Snehal Mandpe
4.Shreyas Khadke

1. 2. 3. 4. 5.
TABLE OF CONTENTS.
INTRODUCTION EXAMPLE APPROACHES ALGORITHM
AND
ADVANTAGES
CONCLUSION

INTRODUCTION
N-Queens dates back to the 19
th
century
(Studied by Gauss).
Classical combinatorial problem, widely
used as a benchmark because of its simple
and regular structure.
Problem involves placing N queens on an N
x N chessboard such that no queen can
attack any other.
.Benchnark code versions include finding
the first solution and finding all solutions.

4 Queen
Problem
Example
4 – Queens ’ problem is
to place 4 – queens on
a 4 x 4 chessboard in
such a manner that no
queens attack each
other by being in the
same row, column, or
diagonal.

APPROACHES
1. Brute Force 4. Divide And Conquer
Approach
5. Graph Theory
Concepts

3. Permutation
Generation
2. Backtracking
6. Mathematical
Solutions

ALGORITHM
Time Complexity : O(N²)
Auxiliary Space : O(N)

Flow Chart

ADVANTAGE
OVER OTHER METHODS.
The advantage of the backtracking algorithm is
the ability to find and count all the possible
solutions rather than just one while offering
decent speed. The backtracking algorithm
increasing speed several times just by starting
multiple threads with different starting
positions of the first queens.

N-Queen Problem
CONCLUSION
1.In N-Queen, as N value increases the time of processing also
takes more time. This happens when we try to display all the
possible solutions.
2.Of course, we could make it much faster if we wanted to only find
one solution instead of all of them: not more than a few
milliseconds for board sizes up to 50.

DO YOU HAVE ANY QUESTIONS?
THANK YOU!