快速排序QuickSort.c
来源:互联网 发布:mmd口型数据 编辑:程序博客网 时间:2024/04/20 05:34
#include<stdio.h>
int sorted(int a[],int low,int high){
int temp=0;
int sign=a[low];
while(low<high){
while(low<high && sign<a[high])
--high;
temp=a[high];
a[high]=a[low];
a[low]=temp;
while(low<high && a[low]<sign)
++low;
temp=a[low];
a[low]=a[high];
a[high]=temp;
}
return low;
}
void sort(int a[],int low,int high){
int sign=0;
if(low<high){
sign=sorted(a,low,high);
sort(a,low,sign-1);
sort(a,sign+1,high);
}
}
void main()
{
int a[20];
int i=0;
int count=0;
printf("count= ");
scanf("%d",&count);
for(i=0;i<count;i++){
printf("a[%d]=",i);
scanf("%d",&a[i]);
}
sort(a,0,count-1);
printf("/nThe sorted numbers:/n");
for(i=0;i<count;i++)
printf("%d ",a[i]);
printf("/nSort Work Is OK!/n/n");
getchar();
}
- 快速排序QuickSort.c
- (C#)快速排序 Quicksort
- 快速排序(QuickSort)C语言版
- QuickSort -- 快速排序(C++)
- QUicKSort 快速排序算法 c实现
- QuickSort - 快速排序算法(C++)
- QuickSort - 快速排序算法(C++)
- 快速排序 QuickSort c语言实现
- 排序算法之快速排序(Quicksort) (C语言)
- 快速排序(quicksort)
- QuickSort(快速排序)
- 快速排序(quicksort)
- 快速排序QuickSort
- 快速排序(QuickSort)
- QuickSort(快速排序)
- 快速排序(quickSort)
- 快速排序(Quicksort)
- 快速排序 QuickSort
- pure pure heart 歌词
- The difference of typeof and GetType method
- 汉字按字节进行计算,并进行分解,用于短信机发送
- DataSet多表关联实现本地数据复杂的查询
- 要去杭州了。。有点不舍
- 快速排序QuickSort.c
- 坚持每天至少一百行。练习数据结构线性表
- SQL日期转换函数
- 日期转换处理相关
- 指令名称 : chmod
- 每天读一遍,不久你就会变!
- 报表中常用到的日期计算方式
- equals方法的特性
- sfg