插入排序与快速排序
#include"iostream"
#define ARR_SIZE(a)
(sizeof((a)) / sizeof((a[0])))
int a[] = {1, 23, 32, 0, 2, 5, 23};
void insert_sort(int *a, int n) {
int i, j,
temp;
for (i = 1;
i < n; i++) {
temp = a[i];
for (j = i - 1; j >= 0 && temp <
a[j]; j--) {
a[j + 1] = a[j];
}
a[j + 1] = temp;
}
}
void quick_sort(int *a, size_t left, size_t right){
size_t p =
(left + right) / 2;
int pivot =
a[p];
size_t i =
left, j = right;
for(;i <
j;){
while (i < p && a[i] <=
pivot)++i;
if (i < p){
a[p] = a[i];
p = i;
}
while (j > p && a[j] >=
pivot)--j;
if (j > p){
a[p] = a[j];
p = j;
}
a[p] = pivot;
if (p - left > 1)quick_sort(a, left, p -
1);
if(right - p > 1)quick_sort(a, p + 1,
right);
}
}
#define ARR_SIZE(a)
int a[] = {1, 23, 32, 0, 2, 5, 23};
void insert_sort(int *a, int n) {
}
void quick_sort(int *a, size_t left, size_t right){
}