Update 8.9基数排序(稳定).md

This commit is contained in:
岩岩
2022-03-29 12:35:08 +08:00
committed by GitHub
parent f21286cd80
commit de05dbb763

View File

@@ -1,6 +1,6 @@
## 基数排序——Radix Sort ## 基数排序——Radix Sort
![uTools_1638539983688](F:\408数据结构\图片\uTools_1638539983688.png) ![uTools_1638539983688](https://github.com/oxyanyano/2022-WangDao-CS-DS-Notes/blob/main/images/uTools_1638539983688.png)
`基数排序`是按照低位先排序,然后收集;再按照高位排序,然后再收集;依次类推,直到最高位。有时候有些属性是有优先级顺序的,先按低优先级排序,再按高优先级排序。最后的次序就是高优先级高的在前,高优先级相同的低优先级高的在前。 `基数排序`是按照低位先排序,然后收集;再按照高位排序,然后再收集;依次类推,直到最高位。有时候有些属性是有优先级顺序的,先按低优先级排序,再按高优先级排序。最后的次序就是高优先级高的在前,高优先级相同的低优先级高的在前。
@@ -12,7 +12,7 @@ n为元素个数
基数排序擅长树立d小r小n大的元素序列进行排序。 基数排序擅长树立d小r小n大的元素序列进行排序。
![uTools_1638540152741](F:\408数据结构\图片\uTools_1638540152741.png) ![uTools_1638540152741](https://github.com/oxyanyano/2022-WangDao-CS-DS-Notes/blob/main/images/uTools_1638540152741.png)
### 一、算法思想: ### 一、算法思想:
@@ -26,7 +26,7 @@ n为元素个数
需一个辅助链队列来实现 需一个辅助链队列来实现
![uTools_1638540352134](F:\408数据结构\图片\uTools_1638540352134.png) ![uTools_1638540352134](https://github.com/oxyanyano/2022-WangDao-CS-DS-Notes/blob/main/images/uTools_1638540352134.png)
```c ```c
int *B = (int *)malloc(n*sizeof(int)); //辅助数组B int *B = (int *)malloc(n*sizeof(int)); //辅助数组B
@@ -68,4 +68,4 @@ void MergeSort(int A[],int low,int high){
### 四、基数排序的应用 ### 四、基数排序的应用
![uTools_1638541177922](F:\408数据结构\图片\uTools_1638541177922.png) ![uTools_1638541177922](https://github.com/oxyanyano/2022-WangDao-CS-DS-Notes/blob/main/images/uTools_1638541177922.png)