-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update the book with the thrid revised edition * Fix a typo * Update the contributors' information * Update the mindmap * Update the version number
- Loading branch information
Showing
33 changed files
with
50 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: liuyuxin ([email protected]) | ||
*/ | ||
|
||
/* 回溯算法:N 皇后 */ | ||
/* 回溯算法:n 皇后 */ | ||
void backtrack( | ||
int row, | ||
int n, | ||
|
@@ -46,7 +46,7 @@ void backtrack( | |
} | ||
} | ||
|
||
/* 求解 N 皇后 */ | ||
/* 求解 n 皇后 */ | ||
List<List<List<String>>> nQueens(int n) { | ||
// 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位 | ||
List<List<String>> state = List.generate(n, (index) => List.filled(n, "#")); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: Justin ([email protected]) | ||
*/ | ||
|
||
/* 回溯算法:N 皇后 */ | ||
/* 回溯算法:n 皇后 */ | ||
function backtrack(row, n, state, res, cols, diags1, diags2) { | ||
// 当放置完所有行时,记录解 | ||
if (row === n) { | ||
|
@@ -30,7 +30,7 @@ function backtrack(row, n, state, res, cols, diags1, diags2) { | |
} | ||
} | ||
|
||
/* 求解 N 皇后 */ | ||
/* 求解 n 皇后 */ | ||
function nQueens(n) { | ||
// 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位 | ||
const state = Array.from({ length: n }, () => Array(n).fill('#')); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: codingonion ([email protected]) | ||
*/ | ||
|
||
/* 回溯算法:N 皇后 */ | ||
/* 回溯算法:n 皇后 */ | ||
fn backtrack(row: usize, n: usize, state: &mut Vec<Vec<String>>, res: &mut Vec<Vec<Vec<String>>>, | ||
cols: &mut [bool], diags1: &mut [bool], diags2: &mut [bool]) { | ||
// 当放置完所有行时,记录解 | ||
|
@@ -35,7 +35,7 @@ fn backtrack(row: usize, n: usize, state: &mut Vec<Vec<String>>, res: &mut Vec<V | |
} | ||
} | ||
|
||
/* 求解 N 皇后 */ | ||
/* 求解 n 皇后 */ | ||
fn n_queens(n: usize) -> Vec<Vec<Vec<String>>> { | ||
// 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位 | ||
let mut state: Vec<Vec<String>> = Vec::new(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: nuomi1 ([email protected]) | ||
*/ | ||
|
||
/* 回溯算法:N 皇后 */ | ||
/* 回溯算法:n 皇后 */ | ||
func backtrack(row: Int, n: Int, state: inout [[String]], res: inout [[[String]]], cols: inout [Bool], diags1: inout [Bool], diags2: inout [Bool]) { | ||
// 当放置完所有行时,记录解 | ||
if row == n { | ||
|
@@ -34,7 +34,7 @@ func backtrack(row: Int, n: Int, state: inout [[String]], res: inout [[[String]] | |
} | ||
} | ||
|
||
/* 求解 N 皇后 */ | ||
/* 求解 n 皇后 */ | ||
func nQueens(n: Int) -> [[[String]]] { | ||
// 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位 | ||
var state = Array(repeating: Array(repeating: "#", count: n), count: n) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Author: Justin ([email protected]) | ||
*/ | ||
|
||
/* 回溯算法:N 皇后 */ | ||
/* 回溯算法:n 皇后 */ | ||
function backtrack( | ||
row: number, | ||
n: number, | ||
|
@@ -38,7 +38,7 @@ function backtrack( | |
} | ||
} | ||
|
||
/* 求解 N 皇后 */ | ||
/* 求解 n 皇后 */ | ||
function nQueens(n: number): string[][][] { | ||
// 初始化 n*n 大小的棋盘,其中 'Q' 代表皇后,'#' 代表空位 | ||
const state = Array.from({ length: n }, () => Array(n).fill('#')); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# N 皇后问题 | ||
# n 皇后问题 | ||
|
||
!!! question | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
在本节中,我们先求解另一个常见的背包问题:完全背包,再了解它的一种特例:零钱兑换。 | ||
|
||
## 完全背包 | ||
## 完全背包问题 | ||
|
||
!!! question | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# 图基础操作 | ||
# 图的基础操作 | ||
|
||
图的基础操作可分为对“边”的操作和对“顶点”的操作。在“邻接矩阵”和“邻接表”两种表示方法下,实现方式有所不同。 | ||
|
||
|
Binary file modified
BIN
-5.38 KB
(97%)
docs/chapter_preface/about_the_book.assets/hello_algo_mindmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.