Update quick_sort.md

This commit is contained in:
Yudong Jin 2022-11-29 20:20:36 +08:00 committed by GitHub
parent 9b2a12dd61
commit 5d96748b7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,7 +57,7 @@ comments: true
swap(nums, i, j); // 交换这两个元素 swap(nums, i, j); // 交换这两个元素
} }
swap(nums, i, left); // 将基准数交换至两子数组的分界线 swap(nums, i, left); // 将基准数交换至两子数组的分界线
return i; // 返回分界线的索引 return i; // 返回基准数的索引(即分界线的位置)
} }
``` ```
@ -83,7 +83,7 @@ comments: true
swap(nums, i, j); // 交换这两个元素 swap(nums, i, j); // 交换这两个元素
} }
swap(nums, i, left); // 将基准数交换至两子数组的分界线 swap(nums, i, left); // 将基准数交换至两子数组的分界线
return i; // 返回分界线的索引 return i; // 返回基准数的索引(即分界线的位置)
} }
``` ```
@ -103,7 +103,7 @@ comments: true
nums[i], nums[j] = nums[j], nums[i] nums[i], nums[j] = nums[j], nums[i]
# 将基准数交换至两子数组的分界线 # 将基准数交换至两子数组的分界线
nums[i], nums[left] = nums[left], nums[i] nums[i], nums[left] = nums[left], nums[i]
return i # 返回分界线的索引 return i # 返回基准数的索引(即分界线的位置)
``` ```
!!! note "快速排序的分治思想" !!! note "快速排序的分治思想"