mirror of
https://github.com/oxyanyano/2022-WangDao-CS-DS-Notes.git
synced 2026-02-02 18:29:00 +08:00
Update 8.9基数排序(稳定).md
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
## 基数排序——Radix Sort
|
## 基数排序——Radix Sort
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
`基数排序`是按照低位先排序,然后收集;再按照高位排序,然后再收集;依次类推,直到最高位。有时候有些属性是有优先级顺序的,先按低优先级排序,再按高优先级排序。最后的次序就是高优先级高的在前,高优先级相同的低优先级高的在前。
|
`基数排序`是按照低位先排序,然后收集;再按照高位排序,然后再收集;依次类推,直到最高位。有时候有些属性是有优先级顺序的,先按低优先级排序,再按高优先级排序。最后的次序就是高优先级高的在前,高优先级相同的低优先级高的在前。
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ n为元素个数
|
|||||||
|
|
||||||
基数排序擅长树立d小,r小,n大的元素序列进行排序。
|
基数排序擅长树立d小,r小,n大的元素序列进行排序。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 一、算法思想:
|
### 一、算法思想:
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ n为元素个数
|
|||||||
|
|
||||||
需一个辅助链队列来实现
|
需一个辅助链队列来实现
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
```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){
|
|||||||
|
|
||||||
### 四、基数排序的应用
|
### 四、基数排序的应用
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
Reference in New Issue
Block a user