三个排序算法:冒泡排序、插入排序、选择排序
/* 本程序测试各种排序方法*/#include#define SORTED 1#define NOTSORTED 0void BubbleSort(int* List,int ListLen);void BubbleSortF(int* list,int length);void EchoList(int* List,int ListLen);void Swap(int* x,int* y);void InsertSort(int* List,int ListLen);void SelectSort(int* List,int ListLen);int main(int argc,char* argv[]){ int Test[]={ 3,4,84,4,3,8,10,12,43}; //BubbleSort(Test,9); BubbleSortF(Test,9); //InsertSort(Test,9); //SelectSort(Test,9); EchoList(Test,9); getchar(); return 0;}void EchoList(int* List,int ListLen){ int i; for(i=0;i 0;j--) { if(temp List[j]) Swap(&temp,&List[j]); } Swap(&temp,&List[i]); }}