Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 66 additions & 66 deletions Code/C++/n_queen_problem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,96 +118,96 @@ int main(){
return 0;
}
/*
TEST CASE 1:
INPUT: 4
OUTPUT:
TEST CASE 1:
INPUT: 4
OUTPUT:

* Q * *
* * * Q
Q * * *
* * Q *
* Q * *
* * * Q
Q * * *
* * Q *


* * Q *
Q * * *
* * * Q
* Q * *
* * Q *
Q * * *
* * * Q
* Q * *

TEST CASE 2:
INPUT: 5
OUTPUT:
TEST CASE 2:
INPUT: 5
OUTPUT:

Q * * * *
* * Q * *
* * * * Q
* Q * * *
* * * Q *
Q * * * *
* * Q * *
* * * * Q
* Q * * *
* * * Q *


Q * * * *
* * * Q *
* Q * * *
* * * * Q
* * Q * *
Q * * * *
* * * Q *
* Q * * *
* * * * Q
* * Q * *


* Q * * *
* * * Q *
Q * * * *
* * Q * *
* * * * Q
* Q * * *
* * * Q *
Q * * * *
* * Q * *
* * * * Q


* Q * * *
* * * * Q
* * Q * *
Q * * * *
* * * Q *
* Q * * *
* * * * Q
* * Q * *
Q * * * *
* * * Q *


* * Q * *
Q * * * *
* * * Q *
* Q * * *
* * * * Q
* * Q * *
Q * * * *
* * * Q *
* Q * * *
* * * * Q


* * Q * *
* * * * Q
* Q * * *
* * * Q *
Q * * * *
* * Q * *
* * * * Q
* Q * * *
* * * Q *
Q * * * *


* * * Q *
Q * * * *
* * Q * *
* * * * Q
* Q * * *
* * * Q *
Q * * * *
* * Q * *
* * * * Q
* Q * * *


* * * Q *
* Q * * *
* * * * Q
* * Q * *
Q * * * *
* * * Q *
* Q * * *
* * * * Q
* * Q * *
Q * * * *


* * * * Q
* Q * * *
* * * Q *
Q * * * *
* * Q * *
* * * * Q
* Q * * *
* * * Q *
Q * * * *
* * Q * *


* * * * Q
* * Q * *
Q * * * *
* * * Q *
* Q * * *
* * * * Q
* * Q * *
Q * * * *
* * * Q *
* Q * * *

TIME COMPLEXITY: O(N!) (N is the user input, that is the number of queens to be placed on a N X N chessboard)
SPACE COMPLEXITY: O(N^2)
TIME COMPLEXITY: O(N!) (N is the user input, that is the number of queens to be placed on a N X N chessboard)
SPACE COMPLEXITY: O(N^2)
*/


Expand Down