摘要:#include<stdio.h> void Merge(int arr[],int L,int M,int R) { int LeftSize=M-L; int RightSize=R-M+1; int Left[LeftSize]; int Right[RightSize]; /*1.fill
阅读全文
posted @ 2020-05-31 23:20
|
|||
05 2020 档案
摘要:#include<stdio.h> void Merge(int arr[],int L,int M,int R) { int LeftSize=M-L; int RightSize=R-M+1; int Left[LeftSize]; int Right[RightSize]; /*1.fill
阅读全文
posted @ 2020-05-31 23:20
摘要:void selectSort(int A[],int N) { int i,j; for(i=0;i<N-1;i++) { for(j=i+1;j<N;j++) { if(A[i]>A[j]) { int tmp=A[j]; A[j]=A[i]; A[i]=tmp; } } } }
阅读全文
posted @ 2020-05-31 23:16
摘要:void bubbleSort(int A[],int N) { int i,j; for(i=0;i<N;i++) { for(j=0;j<N-i-1;j++) { if(A[j]>A[j+1]) { int tmp=A[j+1]; A[j+1]=A[j]; A[j]=tmp; } } } }
阅读全文
posted @ 2020-05-31 23:15
摘要:void shellSort(int A[],int N) { int i,j,k; for(k=N/2;k>0;k/=2) { for(i=k;i<N;i=i+k) { int tmp=A[i]; for(j=i-k;j>=0&&tmp<A[j];j=j-k)/*注意:j>=0,j=j-k*/ {
阅读全文
posted @ 2020-05-31 23:14
摘要:/* **插入排序 */ #include<stdio.h> void InsertSort(int A[],int N) { int i,j; for(i=1;i<N;i++) { int tmp=A[i]; for(j=i-1;j>=0&&tmp<A[j];j--) { A[j+1]=A[j];
阅读全文
posted @ 2020-05-29 22:51
|
|||