二路归并问题
二路归并,但是一直不输出结果,光标停在那,请高手 解答#include<stdio.h>
#include<stdlib.h>
void merge(int A[],int B[],int low,int mid,int high)
{
int i,j,k,m;
m=0;
for(i=low;i<=high;i++)
B[i]=A[i];
for(i=low,j=mid+1,k=i;i<=mid&&j<=high;k++);
{
if(B[i]>B[j])
{
A[k]=B[j++];
}
else
A[k]=B[i++];
}
while(i<=mid)
A[k++]=B[i++];
while(j<=high)
A[k++]=B[j++];
}
void count(int A[],int B[],int low,int high)
{
if(low<high)
{
int mid=(low+high)/2;
count(A,B,low,mid);
count(A,B,mid+1,high);
merge(A,B,low,mid,high);
}
}
int main()
{
int a[7];
int data[]={1,6,8,2,9,10,3};
count(data,a,0,6);
for(int i=0;i<7;i++)
printf("%d\n",data[i]);
return 0;
}