diff --git a/codes/python/chapter_sorting/merge_sort.py b/codes/python/chapter_sorting/merge_sort.py index 4610399cba..dbd32e6656 100644 --- a/codes/python/chapter_sorting/merge_sort.py +++ b/codes/python/chapter_sorting/merge_sort.py @@ -41,7 +41,7 @@ def merge_sort(nums: list[int], left: int, right: int): if left >= right: return # 当子数组长度为 1 时终止递归 # 划分阶段 - mid = left + (right - left) // 2 # 计算中点 + mid = (left + right) // 2 # 计算中点 merge_sort(nums, left, mid) # 递归左子数组 merge_sort(nums, mid + 1, right) # 递归右子数组 # 合并阶段