From 1b71e74baac5f79073a7179d509b78a42962a59a Mon Sep 17 00:00:00 2001 From: GN-Yu <58758623+GN-Yu@users.noreply.github.com> Date: Fri, 30 Dec 2022 13:21:03 -0500 Subject: [PATCH] Update merge_sort.cs --- codes/csharp/chapter_sorting/merge_sort.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codes/csharp/chapter_sorting/merge_sort.cs b/codes/csharp/chapter_sorting/merge_sort.cs index 04ac8acdd..e66ae5e23 100644 --- a/codes/csharp/chapter_sorting/merge_sort.cs +++ b/codes/csharp/chapter_sorting/merge_sort.cs @@ -31,10 +31,10 @@ namespace hello_algo.chapter_sorting // 若“左子数组已全部合并完”,则选取右子数组元素,并且 j++ if (i > leftEnd) nums[k] = tmp[j++]; - // 否则,若“右子数组已全部合并完”或“左子数组元素 < 右子数组元素”,则选取左子数组元素,并且 i++ + // 否则,若“右子数组已全部合并完”或“左子数组元素 <= 右子数组元素”,则选取左子数组元素,并且 i++ else if (j > rightEnd || tmp[i] <= tmp[j]) nums[k] = tmp[i++]; - // 否则,若“左子数组元素 > 右子数组元素”,则选取右子数组元素,并且 j++ + // 否则,若“左右子数组都未全部合并完”且“左子数组元素 > 右子数组元素”,则选取右子数组元素,并且 j++ else nums[k] = tmp[j++]; }