auto commit
This commit is contained in:
parent
12dc592eeb
commit
dfd1006299
BIN
docs/notes/pics/2_200.png
Normal file
BIN
docs/notes/pics/2_200.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
docs/notes/pics/3_200.png
Normal file
BIN
docs/notes/pics/3_200.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
docs/notes/pics/61550402057509.gif
Normal file
BIN
docs/notes/pics/61550402057509.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
@ -416,7 +416,7 @@ public class Shell<T extends Comparable<T>> extends Sort<T> {
|
||||
|
||||
归并排序的思想是将数组分成两部分,分别进行排序,然后归并起来。
|
||||
|
||||
<div align="center"> <img src="pics/220790c6-4377-4a2e-8686-58398afc8a18.png" width="350"/> </div><br>
|
||||
<div align="center"> <img src="pics/2_200.png"/> </div><br>
|
||||
|
||||
### 1. 归并方法
|
||||
|
||||
@ -511,7 +511,7 @@ public class Down2UpMergeSort<T extends Comparable<T>> extends MergeSort<T> {
|
||||
- 归并排序将数组分为两个子数组分别排序,并将有序的子数组归并使得整个数组排序;
|
||||
- 快速排序通过一个切分元素将数组分为两个子数组,左子数组小于等于切分元素,右子数组大于等于切分元素,将这两个子数组排序也就将整个数组排序了。
|
||||
|
||||
<div align="center"> <img src="pics/f8047846-efd4-42be-b6b7-27a7c4998b51.png" width="500"/> </div><br>
|
||||
<div align="center"> <img src="pics/3_200.png"/> </div><br>
|
||||
|
||||
```java
|
||||
public class QuickSort<T extends Comparable<T>> extends Sort<T> {
|
||||
@ -542,7 +542,7 @@ public class QuickSort<T extends Comparable<T>> extends Sort<T> {
|
||||
|
||||
取 a[l] 作为切分元素,然后从数组的左端向右扫描直到找到第一个大于等于它的元素,再从数组的右端向左扫描找到第一个小于它的元素,交换这两个元素。不断进行这个过程,就可以保证左指针 i 的左侧元素都不大于切分元素,右指针 j 的右侧元素都不小于切分元素。当两个指针相遇时,将切分元素 a[l] 和 a[j] 交换位置。
|
||||
|
||||
<div align="center"> <img src="pics/766aedd0-1b00-4065-aa2b-7d31138df84f.png" width="400"/> </div><br>
|
||||
<div align="center"> <img src="pics/61550402057509.gif"/> </div><br>
|
||||
|
||||
```java
|
||||
private int partition(T[] nums, int l, int h) {
|
||||
|
BIN
docs/pics/2_200.png
Normal file
BIN
docs/pics/2_200.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
docs/pics/3_200.png
Normal file
BIN
docs/pics/3_200.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
docs/pics/61550402057509.gif
Normal file
BIN
docs/pics/61550402057509.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Loading…
x
Reference in New Issue
Block a user