//bubblesort void bubbleSort(int a[],int n) { int temp; for(int i=n-1;i>0;--i){ for(int j=0;j<i;++j){ if(a[j+1]<a[j]) { temp=a[j+1]; a[j+1]=a[j]; a[j]=temp; } } } } //quicksort int partition(int a[],int low,int hight){ int key=a[low]; while(low<hight){ while(low<hight&&a[hight]>=key) --hight; a[low]=a[hight]; while(low<hight&&a[low]<=key) ++low; a[hight]=a[low]; } a[low]=key; return low; } void qsort(int a[],int low,int hight){ if(low<hight){ int middle=partition(a,low,hight); qsort(a,low,middle-1); qsort(a,middle+1,hight); } } void quick_sort(int a[],int low,int hight){ qsort(a,low,hight); } //selectsort void select_sort(int a[],int n){ int min; for(int i=0;i<n-1;++i){ min=i; for(int j=i+1;j<n;++j) { if(a[j]<a[min]) min=j; } if(min!=i){ int temp=a[i]; a[i]=a[min]; a[min]=temp; } } }