mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 04:31:55 +08:00
fix: Polishing code format on linearLogRecur, convert String type to string (#841)
This commit is contained in:
@ -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++;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user