diff --git a/codes/csharp/chapter_computational_complexity/time_complexity.cs b/codes/csharp/chapter_computational_complexity/time_complexity.cs index 44c2f6a7e..42e51ce02 100644 --- a/codes/csharp/chapter_computational_complexity/time_complexity.cs +++ b/codes/csharp/chapter_computational_complexity/time_complexity.cs @@ -134,8 +134,7 @@ public class time_complexity { /* 线性对数阶 */ static int LinearLogRecur(float n) { if (n <= 1) return 1; - int count = LinearLogRecur(n / 2) + - LinearLogRecur(n / 2); + int count = LinearLogRecur(n / 2) + LinearLogRecur(n / 2); for (int i = 0; i < n; i++) { count++; } diff --git a/codes/csharp/chapter_computational_complexity/worst_best_time_complexity.cs b/codes/csharp/chapter_computational_complexity/worst_best_time_complexity.cs index 0656f64b2..bdf86ce1b 100644 --- a/codes/csharp/chapter_computational_complexity/worst_best_time_complexity.cs +++ b/codes/csharp/chapter_computational_complexity/worst_best_time_complexity.cs @@ -17,11 +17,8 @@ public class worst_best_time_complexity { // 随机打乱数组元素 for (int i = 0; i < nums.Length; i++) { - var index = new Random().Next(i, nums.Length); - var tmp = nums[i]; - var ran = nums[index]; - nums[i] = ran; - nums[index] = tmp; + int index = new Random().Next(i, nums.Length); + (nums[i], nums[index]) = (nums[index], nums[i]); } return nums; } diff --git a/codes/go/chapter_computational_complexity/time_complexity.go b/codes/go/chapter_computational_complexity/time_complexity.go index c11ab4791..cdb09b755 100644 --- a/codes/go/chapter_computational_complexity/time_complexity.go +++ b/codes/go/chapter_computational_complexity/time_complexity.go @@ -109,8 +109,7 @@ func linearLogRecur(n float64) int { if n <= 1 { return 1 } - count := linearLogRecur(n/2) + - linearLogRecur(n/2) + count := linearLogRecur(n / 2) + linearLogRecur(n / 2) for i := 0.0; i < n; i++ { count++ } diff --git a/codes/java/chapter_computational_complexity/time_complexity.java b/codes/java/chapter_computational_complexity/time_complexity.java index a9bf97fe9..b5d0c3cd9 100644 --- a/codes/java/chapter_computational_complexity/time_complexity.java +++ b/codes/java/chapter_computational_complexity/time_complexity.java @@ -107,8 +107,7 @@ public class time_complexity { static int linearLogRecur(float n) { if (n <= 1) return 1; - int count = linearLogRecur(n / 2) + - linearLogRecur(n / 2); + int count = linearLogRecur(n / 2) + linearLogRecur(n / 2); for (int i = 0; i < n; i++) { count++; } diff --git a/codes/rust/chapter_computational_complexity/time_complexity.rs b/codes/rust/chapter_computational_complexity/time_complexity.rs index 665931526..3473dd08b 100644 --- a/codes/rust/chapter_computational_complexity/time_complexity.rs +++ b/codes/rust/chapter_computational_complexity/time_complexity.rs @@ -111,8 +111,7 @@ fn linear_log_recur(n: f32) -> i32 { if n <= 1.0 { return 1; } - let mut count = linear_log_recur(n / 2.0) + - linear_log_recur(n / 2.0); + let mut count = linear_log_recur(n / 2.0) + linear_log_recur(n / 2.0); for _ in 0 ..n as i32 { count += 1; } diff --git a/codes/zig/chapter_computational_complexity/time_complexity.zig b/codes/zig/chapter_computational_complexity/time_complexity.zig index 3327fb37a..92439e96a 100644 --- a/codes/zig/chapter_computational_complexity/time_complexity.zig +++ b/codes/zig/chapter_computational_complexity/time_complexity.zig @@ -115,8 +115,7 @@ fn logRecur(n: f32) i32 { // 线性对数阶 fn linearLogRecur(n: f32) i32 { if (n <= 1) return 1; - var count: i32 = linearLogRecur(n / 2) + - linearLogRecur(n / 2); + var count: i32 = linearLogRecur(n / 2) + linearLogRecur(n / 2); var i: f32 = 0; while (i < n) : (i += 1) { count += 1; diff --git a/docs/chapter_hashing/hash_map.md b/docs/chapter_hashing/hash_map.md index 9b0af22c2..eec4e9826 100755 --- a/docs/chapter_hashing/hash_map.md +++ b/docs/chapter_hashing/hash_map.md @@ -339,7 +339,7 @@ Console.WriteLine(key); } // 单独遍历值 value - foreach (String val in map.Values) { + foreach (string val in map.Values) { Console.WriteLine(val); } ```