#include
void merger(int d1[10],int t1,int d2[10],int t2,int result[20])
{ int k1=0,k2=0,k=0;
while(k1
else
result[k++]=d2[k2++];
}
if(k1
else
for(k1=k2;k1
}
int main()
{ int data1[10]={3,5,7,9,12,19,25,26,27},data2[10]={1,4,6,8,9,15,17,21},r[20];
int total1=6,total2=8,k;
merger(data1,total1,data2,total2,r);
for(k=0; k
printf("\ntotal1=%d total2=%d",total1,total2) ;
system("pause");
}
这是用两路合并排序算发