Skip to content

Commit f697697

Browse files
authored
Prepare 1.0.0 release (#1044)
* Update the book with the thrid revised edition * Fix a typo * Update the contributors' information * Update the mindmap * Update the version number
1 parent b9ae4ff commit f697697

File tree

33 files changed

+50
-49
lines changed

33 files changed

+50
-49
lines changed

codes/c/chapter_backtracking/n_queens.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#define MAX_SIZE 100
1010

11-
/* 回溯算法:N 皇后 */
11+
/* 回溯算法:n 皇后 */
1212
void backtrack(int row, int n, char state[MAX_SIZE][MAX_SIZE], char ***res, int *resSize, bool cols[MAX_SIZE],
1313
bool diags1[2 * MAX_SIZE - 1], bool diags2[2 * MAX_SIZE - 1]) {
1414
// 当放置完所有行时,记录解
@@ -40,7 +40,7 @@ void backtrack(int row, int n, char state[MAX_SIZE][MAX_SIZE], char ***res, int
4040
}
4141
}
4242

43-
/* 求解 N 皇后 */
43+
/* 求解 n 皇后 */
4444
char ***nQueens(int n, int *returnSize) {
4545
char state[MAX_SIZE][MAX_SIZE];
4646
// 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位

codes/cpp/chapter_backtracking/n_queens.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include "../utils/common.hpp"
88

9-
/* 回溯算法:N 皇后 */
9+
/* 回溯算法:n 皇后 */
1010
void backtrack(int row, int n, vector<vector<string>> &state, vector<vector<vector<string>>> &res, vector<bool> &cols,
1111
vector<bool> &diags1, vector<bool> &diags2) {
1212
// 当放置完所有行时,记录解
@@ -33,7 +33,7 @@ void backtrack(int row, int n, vector<vector<string>> &state, vector<vector<vect
3333
}
3434
}
3535

36-
/* 求解 N 皇后 */
36+
/* 求解 n 皇后 */
3737
vector<vector<vector<string>>> nQueens(int n) {
3838
// 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位
3939
vector<vector<string>> state(n, vector<string>(n, "#"));

codes/csharp/chapter_backtracking/n_queens.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace hello_algo.chapter_backtracking;
88

99
public class n_queens {
10-
/* 回溯算法:N 皇后 */
10+
/* 回溯算法:n 皇后 */
1111
void Backtrack(int row, int n, List<List<string>> state, List<List<List<string>>> res,
1212
bool[] cols, bool[] diags1, bool[] diags2) {
1313
// 当放置完所有行时,记录解
@@ -38,7 +38,7 @@ void Backtrack(int row, int n, List<List<string>> state, List<List<List<string>>
3838
}
3939
}
4040

41-
/* 求解 N 皇后 */
41+
/* 求解 n 皇后 */
4242
List<List<List<string>>> NQueens(int n) {
4343
// 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位
4444
List<List<string>> state = [];

codes/dart/chapter_backtracking/n_queens.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Author: liuyuxin (gvenusleo@gmail.com)
55
*/
66

7-
/* 回溯算法:N 皇后 */
7+
/* 回溯算法:n 皇后 */
88
void backtrack(
99
int row,
1010
int n,
@@ -46,7 +46,7 @@ void backtrack(
4646
}
4747
}
4848

49-
/* 求解 N 皇后 */
49+
/* 求解 n 皇后 */
5050
List<List<List<String>>> nQueens(int n) {
5151
// 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位
5252
List<List<String>> state = List.generate(n, (index) => List.filled(n, "#"));

codes/go/chapter_backtracking/n_queens.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
package chapter_backtracking
66

7-
/* 回溯算法:N 皇后 */
7+
/* 回溯算法:n 皇后 */
88
func backtrack(row, n int, state *[][]string, res *[][][]string, cols, diags1, diags2 *[]bool) {
99
// 当放置完所有行时,记录解
1010
if row == n {
@@ -35,6 +35,7 @@ func backtrack(row, n int, state *[][]string, res *[][][]string, cols, diags1, d
3535
}
3636
}
3737

38+
/* 求解 n 皇后 */
3839
func nQueens(n int) [][][]string {
3940
// 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位
4041
state := make([][]string, n)

codes/java/chapter_backtracking/n_queens.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import java.util.*;
1010

1111
public class n_queens {
12-
/* 回溯算法:N 皇后 */
12+
/* 回溯算法:n 皇后 */
1313
public static void backtrack(int row, int n, List<List<String>> state, List<List<List<String>>> res,
1414
boolean[] cols, boolean[] diags1, boolean[] diags2) {
1515
// 当放置完所有行时,记录解
@@ -40,7 +40,7 @@ public static void backtrack(int row, int n, List<List<String>> state, List<List
4040
}
4141
}
4242

43-
/* 求解 N 皇后 */
43+
/* 求解 n 皇后 */
4444
public static List<List<List<String>>> nQueens(int n) {
4545
// 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位
4646
List<List<String>> state = new ArrayList<>();

codes/javascript/chapter_backtracking/n_queens.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Author: Justin (xiefahit@gmail.com)
55
*/
66

7-
/* 回溯算法:N 皇后 */
7+
/* 回溯算法:n 皇后 */
88
function backtrack(row, n, state, res, cols, diags1, diags2) {
99
// 当放置完所有行时,记录解
1010
if (row === n) {
@@ -30,7 +30,7 @@ function backtrack(row, n, state, res, cols, diags1, diags2) {
3030
}
3131
}
3232

33-
/* 求解 N 皇后 */
33+
/* 求解 n 皇后 */
3434
function nQueens(n) {
3535
// 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位
3636
const state = Array.from({ length: n }, () => Array(n).fill('#'));

codes/python/chapter_backtracking/n_queens.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def backtrack(
1414
diags1: list[bool],
1515
diags2: list[bool],
1616
):
17-
"""回溯算法:N 皇后"""
17+
"""回溯算法:n 皇后"""
1818
# 当放置完所有行时,记录解
1919
if row == n:
2020
res.append([list(row) for row in state])
@@ -37,7 +37,7 @@ def backtrack(
3737

3838

3939
def n_queens(n: int) -> list[list[list[str]]]:
40-
"""求解 N 皇后"""
40+
"""求解 n 皇后"""
4141
# 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位
4242
state = [["#" for _ in range(n)] for _ in range(n)]
4343
cols = [False] * n # 记录列是否有皇后

codes/rust/chapter_backtracking/n_queens.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Author: codingonion (coderonion@gmail.com)
55
*/
66

7-
/* 回溯算法:N 皇后 */
7+
/* 回溯算法:n 皇后 */
88
fn backtrack(row: usize, n: usize, state: &mut Vec<Vec<String>>, res: &mut Vec<Vec<Vec<String>>>,
99
cols: &mut [bool], diags1: &mut [bool], diags2: &mut [bool]) {
1010
// 当放置完所有行时,记录解
@@ -35,7 +35,7 @@ fn backtrack(row: usize, n: usize, state: &mut Vec<Vec<String>>, res: &mut Vec<V
3535
}
3636
}
3737

38-
/* 求解 N 皇后 */
38+
/* 求解 n 皇后 */
3939
fn n_queens(n: usize) -> Vec<Vec<Vec<String>>> {
4040
// 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位
4141
let mut state: Vec<Vec<String>> = Vec::new();

codes/swift/chapter_backtracking/n_queens.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Author: nuomi1 (nuomi1@qq.com)
55
*/
66

7-
/* 回溯算法:N 皇后 */
7+
/* 回溯算法:n 皇后 */
88
func backtrack(row: Int, n: Int, state: inout [[String]], res: inout [[[String]]], cols: inout [Bool], diags1: inout [Bool], diags2: inout [Bool]) {
99
// 当放置完所有行时,记录解
1010
if row == n {
@@ -34,7 +34,7 @@ func backtrack(row: Int, n: Int, state: inout [[String]], res: inout [[[String]]
3434
}
3535
}
3636

37-
/* 求解 N 皇后 */
37+
/* 求解 n 皇后 */
3838
func nQueens(n: Int) -> [[[String]]] {
3939
// 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位
4040
var state = Array(repeating: Array(repeating: "#", count: n), count: n)

0 commit comments

Comments
 (0)