A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/d4/d3e/n__queens_8cpp_source.html below:

TheAlgorithms/C++: backtracking/n_queens.cpp Source File

Go to the documentation of this file. 40 for

(

int

i = 0; i < n; i++) {

41 for

(

int

j = 0; j < n; j++) {

42

std::cout <<

""

<< board[i][j] <<

" "

;

58bool isSafe

(

const

std::array<std::array<int, n>, n> &board,

const int

&row,

63 for

(i = 0; i < col; i++) {

70 for

(i = row, j = col; i >= 0 && j >= 0; i--, j--) {

76 for

(i = row, j = col; j >= 0 && i < n; i++, j--) {

91void solveNQ

(std::array<std::array<int, n>, n> board,

const int

&col) {

99 for

(

int

i = 0; i < n; i++) {

122

std::array<std::array<int, n>, n> board = {

123

std::array<int, n>({0, 0, 0, 0}), std::array<int, n>({0, 0, 0, 0}),

124

std::array<int, n>({0, 0, 0, 0}), std::array<int, n>({0, 0, 0, 0})};

void solveNQ(std::array< std::array< int, n >, n > board, const int &col)

void printSolution(const std::array< std::array< int, n >, n > &board)

bool isSafe(const std::array< std::array< int, n >, n > &board, const int &row, const int &col)

int main()

Main function.

Functions for Eight Queens puzzle.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4