1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

Update 10-classical-sorting-algorithms.md

This commit is contained in:
Mooby 2023-09-27 16:48:15 +08:00 committed by GitHub
parent e778f21f6f
commit 5e457ab678
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -357,7 +357,7 @@ public static int[] merge(int[] arr_1, int[] arr_2) {
### 算法步骤
快速排序使用[分治法](https://zh.wikipedia.org/wiki/分治法)Divide and conquer策略来把一个序列分为较小和较大的 2 个子序列,然后递地排序两个子序列。具体算法描述如下:
快速排序使用[分治法](https://zh.wikipedia.org/wiki/分治法)Divide and conquer策略来把一个序列分为较小和较大的 2 个子序列,然后递地排序两个子序列。具体算法描述如下:
1. 从序列中**随机**挑出一个元素,做为 “基准”(`pivot`)
2. 重新排列序列将所有比基准值小的元素摆放在基准前面所有比基准值大的摆在基准的后面相同的数可以到任一边。在这个操作结束之后该基准就处于数列的中间位置。这个称为分区partition操作
@ -738,4 +738,4 @@ public static int[] radixSort(int[] arr) {
- <https://en.wikipedia.org/wiki/Sorting_algorithm>
- <https://sort.hust.cc/>
<!-- @include: @article-footer.snippet.md -->
<!-- @include: @article-footer.snippet.md -->