Skip to content

Commit

Permalink
fix several bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
krahets committed Oct 17, 2023
1 parent 51405c0 commit 5392afd
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void printFunc(vector *v, void *p) {
}

/* 前序遍历:例题一 */
static void preOrder(TreeNode *root) {
void preOrder(TreeNode *root) {
if (root == NULL) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion codes/c/chapter_divide_and_conquer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
add_executable(binary_search_recur binary_search_recur.c)
add_executable(hanota hanota.c)
add_executable(build_tree build_tree.c)
add_executable(hanota hanota.c)
2 changes: 1 addition & 1 deletion codes/c/chapter_hashing/hash_map_chaining.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef struct pair Pair;
/* 链表节点 */
struct node {
Pair *pair;
struct Node *next;
struct node *next;
};

typedef struct node Node;
Expand Down
2 changes: 1 addition & 1 deletion codes/cpp/chapter_backtracking/permutations_i.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void backtrack(vector<int> &state, const vector<int> &choices, vector<bool> &sel
// 遍历所有选择
for (int i = 0; i < choices.size(); i++) {
int choice = choices[i];
// 剪枝:不允许重复选择元素 且 不允许重复选择相等元素
// 剪枝:不允许重复选择元素
if (!selected[i]) {
// 尝试:做出选择,更新状态
selected[i] = true;
Expand Down
2 changes: 1 addition & 1 deletion codes/csharp/chapter_backtracking/permutations_i.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static void Backtrack(List<int> state, int[] choices, bool[] selected, List<List
// 遍历所有选择
for (int i = 0; i < choices.Length; i++) {
int choice = choices[i];
// 剪枝:不允许重复选择元素 且 不允许重复选择相等元素
// 剪枝:不允许重复选择元素
if (!selected[i]) {
// 尝试:做出选择,更新状态
selected[i] = true;
Expand Down
2 changes: 1 addition & 1 deletion codes/dart/chapter_backtracking/permutations_i.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void backtrack(
// 遍历所有选择
for (int i = 0; i < choices.length; i++) {
int choice = choices[i];
// 剪枝:不允许重复选择元素 且 不允许重复选择相等元素
// 剪枝:不允许重复选择元素
if (!selected[i]) {
// 尝试:做出选择,更新状态
selected[i] = true;
Expand Down
2 changes: 1 addition & 1 deletion codes/go/chapter_backtracking/permutations_i.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func backtrackI(state *[]int, choices *[]int, selected *[]bool, res *[][]int) {
// 遍历所有选择
for i := 0; i < len(*choices); i++ {
choice := (*choices)[i]
// 剪枝:不允许重复选择元素 且 不允许重复选择相等元素
// 剪枝:不允许重复选择元素
if !(*selected)[i] {
// 尝试:做出选择,更新状态
(*selected)[i] = true
Expand Down
2 changes: 1 addition & 1 deletion codes/java/chapter_backtracking/permutations_i.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void backtrack(List<Integer> state, int[] choices, boolean[] selec
// 遍历所有选择
for (int i = 0; i < choices.length; i++) {
int choice = choices[i];
// 剪枝:不允许重复选择元素 且 不允许重复选择相等元素
// 剪枝:不允许重复选择元素
if (!selected[i]) {
// 尝试:做出选择,更新状态
selected[i] = true;
Expand Down
2 changes: 1 addition & 1 deletion codes/javascript/chapter_backtracking/permutations_i.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function backtrack(state, choices, selected, res) {
}
// 遍历所有选择
choices.forEach((choice, i) => {
// 剪枝:不允许重复选择元素 且 不允许重复选择相等元素
// 剪枝:不允许重复选择元素
if (!selected[i]) {
// 尝试:做出选择,更新状态
selected[i] = true;
Expand Down
2 changes: 1 addition & 1 deletion codes/rust/chapter_backtracking/permutations_i.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn backtrack(mut state: Vec<i32>, choices: &[i32], selected: &mut [bool], res: &
// 遍历所有选择
for i in 0..choices.len() {
let choice = choices[i];
// 剪枝:不允许重复选择元素 且 不允许重复选择相等元素
// 剪枝:不允许重复选择元素
if !selected[i] {
// 尝试:做出选择,更新状态
selected[i] = true;
Expand Down
2 changes: 1 addition & 1 deletion codes/swift/chapter_backtracking/permutations_i.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func backtrack(state: inout [Int], choices: [Int], selected: inout [Bool], res:
}
// 遍历所有选择
for (i, choice) in choices.enumerated() {
// 剪枝:不允许重复选择元素 且 不允许重复选择相等元素
// 剪枝:不允许重复选择元素
if !selected[i] {
// 尝试:做出选择,更新状态
selected[i] = true
Expand Down
2 changes: 1 addition & 1 deletion codes/typescript/chapter_backtracking/permutations_i.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function backtrack(
}
// 遍历所有选择
choices.forEach((choice, i) => {
// 剪枝:不允许重复选择元素 且 不允许重复选择相等元素
// 剪枝:不允许重复选择元素
if (!selected[i]) {
// 尝试:做出选择,更新状态
selected[i] = true;
Expand Down
4 changes: 2 additions & 2 deletions docs/chapter_array_and_linkedlist/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@

```rust title="list.rs"
/* 访问元素 */
let num: i32 = nums[1]; // 访问索引 1 处的元素
let num: i32 = nums[1]; // 访问索引 1 处的元素
/* 更新元素 */
nums[1] = 0; // 将索引 1 处的元素更新为 0
nums[1] = 0; // 将索引 1 处的元素更新为 0
```

=== "C"
Expand Down
2 changes: 1 addition & 1 deletion docs/chapter_hashing/hash_algorithm.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ $$
=== "Go"

```go title="built_in_hash.go"

// Go 未提供内置 hash code 函数
```

=== "Swift"
Expand Down

0 comments on commit 5392afd

Please sign in to comment.