摘要:
先从下向上从无序区冒出一个最小元素,再从上向下从无序区冒出一个最大的元素。 #include<stdio.h> #define M 5 int main() { int a[M],i,j,l,r,tmp; for(i=0;i<M;i++) scanf("%d",&a[i]); l=0,r=M-1,j 阅读全文
摘要:
1.对八个元素的序列进行快速排序,在最好的情况下,元素间的比较次数为13 #include<stdio.h> #define M 8 int cnt=0; int quickp(int a[],int l,int r) { int i=l,j=r,k; int tmp=a[l],cnt2=0; wh 阅读全文
摘要:
唔,好歹是学到了新东西,不慌。 #include<stdio.h> #include<stdlib.h> #include<malloc.h> #define M 20 typedef int ElemType; typedef struct S { ElemType elem[M]; int l; 阅读全文