Skip to content

Commit

Permalink
Update merge_sort.zig
Browse files Browse the repository at this point in the history
  • Loading branch information
krahets committed May 17, 2024
1 parent d74b654 commit 838b93b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion codes/zig/chapter_sorting/merge_sort.zig
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn mergeSort(nums: []i32, left: usize, right: usize) !void {
// 终止条件
if (left >= right) return; // 当子数组长度为 1 时终止递归
// 划分阶段
var mid = left + (right - left) / 2; // 计算中点
var mid = left + (right - left) / 2; // 计算中点
try mergeSort(nums, left, mid); // 递归左子数组
try mergeSort(nums, mid + 1, right); // 递归右子数组
// 合并阶段
Expand Down

0 comments on commit 838b93b

Please sign in to comment.