mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 00:36:28 +08:00
fix(sort): add c codes
This commit is contained in:
parent
744a37925f
commit
d4d11d9f7d
2 changed files with 2 additions and 2 deletions
|
@ -7,7 +7,7 @@
|
||||||
#include "../include/include.h"
|
#include "../include/include.h"
|
||||||
|
|
||||||
/* 元素交换 */
|
/* 元素交换 */
|
||||||
static void swap(int nums[], int i, int j) {
|
void swap(int nums[], int i, int j) {
|
||||||
int tmp = nums[i];
|
int tmp = nums[i];
|
||||||
nums[i] = nums[j];
|
nums[i] = nums[j];
|
||||||
nums[j] = tmp;
|
nums[j] = tmp;
|
||||||
|
|
|
@ -42,7 +42,7 @@ void countSort(int nums[], int size, int exp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 基数排序 */
|
/* 基数排序 */
|
||||||
static void radixSort(int nums[], int size) {
|
void radixSort(int nums[], int size) {
|
||||||
// 获取数组的最大元素,用于判断最大位数
|
// 获取数组的最大元素,用于判断最大位数
|
||||||
int max = INT32_MIN;
|
int max = INT32_MIN;
|
||||||
for (size_t i = 0; i < size - 1; i++) {
|
for (size_t i = 0; i < size - 1; i++) {
|
||||||
|
|
Loading…
Reference in a new issue