归并排序
代码:#include <stdio.h>
#include <stdlib.h>
void merge(int number[],int first,int last,int mid)
{
}
void merge_sort(int number[],int first,int last)
{
int mid=0;
if(first<last)
{
mid=(first+last)/2;
merge_sort(number,first,mid);
merge_sort(number,mid+1,last);
merge(number,first,last,mid);
}
}
int main()
{
int number[10]={0},n,i;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&number[i]);
merge_sort(number,0,n-1);
for(i=0;i<n;i++)
printf("%d ",number[i]);
system("pause");
return 0;
}
写到merge这个函数就感觉写不下去了。请教各位高手,这个函数怎么写?