Counting Solutions: Difference between revisions

From Algorithm Wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:Counting Solutions (n-Queens Problem)}} == Description == How many ways can one put $n$ queens on an $n \times n$ chessboard so that no two queens attack each other? In other words, how many points can be placed on an $n \times n$ grid so that no two are on the same row, column, or diagonal? == Related Problems == Related: Constructing Solutions, n-Queens Completion == Parameters == <pre>n: number of queens, size of chessboard</pre> == Tab...")
 
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 10: Line 10:
== Parameters ==  
== Parameters ==  


<pre>n: number of queens, size of chessboard</pre>
$n$: number of queens, size of chessboard


== Table of Algorithms ==  
== Table of Algorithms ==  
Line 20: Line 20:
|-
|-


| [[Naive Algorithm (Counting Solutions; Constructing solutions n-Queens Problem)|Naive Algorithm]] || 1848 || $O(n^n)$ || $O(n)$ || Exact || Deterministic || 
|-
| [[Naive + 1 queen per row restriction (Counting Solutions; Constructing solutions n-Queens Problem)|Naive + 1 queen per row restriction]] || 1850 || $O(n!)$ || $O(n)$ || Exact || Deterministic || 
|-
| [[Dijkstra (Counting Solutions; Constructing solutions n-Queens Problem)|Dijkstra]] || 1972 || $O(n!)$ || $O(n)$ || Exact || Deterministic || [https://dl-acm-org.ezproxy.canberra.edu.au/citation.cfm?id=1243380 Time]
|-
| [[Nauck (Counting Solutions; Constructing solutions n-Queens Problem)|Nauck]] || 1850 || $O(n!)$ ||  || Exact || Deterministic || 
|-
| [[Gunther Determinants solution (Counting Solutions; Constructing solutions n-Queens Problem)|Gunther Determinants solution]] || 1874 || $O(n!)$ || $O(n!)$ ? || Exact || Deterministic || 
|-
| [[Rivin, Zabih (Counting Solutions n-Queens Problem)|Rivin, Zabih]] || 1992 || $O({8}^n*poly(n)$) || $O({8}^n*n^{2})$ || Exact || Deterministic || [http://www.cs.cornell.edu/~rdz/Papers/RZ-IPL92.pdf Time & Space]
| [[Rivin, Zabih (Counting Solutions n-Queens Problem)|Rivin, Zabih]] || 1992 || $O({8}^n*poly(n)$) || $O({8}^n*n^{2})$ || Exact || Deterministic || [http://www.cs.cornell.edu/~rdz/Papers/RZ-IPL92.pdf Time & Space]
|-
|-
|}
|}


== Time Complexity graph ==  
== Time Complexity Graph ==  


[[File:n-Queens Problem - Counting Solutions - Time.png|1000px]]
[[File:n-Queens Problem - Counting Solutions - Time.png|1000px]]
== Space Complexity graph ==
[[File:n-Queens Problem - Counting Solutions - Space.png|1000px]]
== Pareto Decades graph ==
[[File:n-Queens Problem - Counting Solutions - Pareto Frontier.png|1000px]]


== References/Citation ==  
== References/Citation ==  


https://dl-acm-org.ezproxy.canberra.edu.au/citation.cfm?id=1243380
https://dl-acm-org.ezproxy.canberra.edu.au/citation.cfm?id=1243380

Latest revision as of 10:12, 28 April 2023

Description

How many ways can one put $n$ queens on an $n \times n$ chessboard so that no two queens attack each other? In other words, how many points can be placed on an $n \times n$ grid so that no two are on the same row, column, or diagonal?

Related Problems

Related: Constructing Solutions, n-Queens Completion

Parameters

$n$: number of queens, size of chessboard

Table of Algorithms

Name Year Time Space Approximation Factor Model Reference
Naive Algorithm 1848 $O(n^n)$ $O(n)$ Exact Deterministic
Naive + 1 queen per row restriction 1850 $O(n!)$ $O(n)$ Exact Deterministic
Dijkstra 1972 $O(n!)$ $O(n)$ Exact Deterministic Time
Nauck 1850 $O(n!)$ Exact Deterministic
Gunther Determinants solution 1874 $O(n!)$ $O(n!)$ ? Exact Deterministic
Rivin, Zabih 1992 $O({8}^n*poly(n)$) $O({8}^n*n^{2})$ Exact Deterministic Time & Space

Time Complexity Graph

N-Queens Problem - Counting Solutions - Time.png

References/Citation

https://dl-acm-org.ezproxy.canberra.edu.au/citation.cfm?id=1243380