标签:pre i++ ret turn else logs ++ return tmp
int num[1005],tmp[1005]; void Merge(int *num,int l,int r) { if( l==r ) return; int mid; mid=l+(r-l)/2; Merge(num,l,mid); Merge(num,mid+1,r); int i=l,j=mid+1,k=0; while( i<=mid&&j<=r ) { if( num[i]<=num[j] ) tmp[k++]=num[i++]; else tmp[k++]=num[j++]; } while( i<=mid ) tmp[k++]=num[i++]; while( j<=r ) tmp[k++]=num[j++]; for( int a=l;a<k+l;a++ ) num[a]=tmp[a-l]; }
标签:pre i++ ret turn else logs ++ return tmp
原文地址:http://www.cnblogs.com/Dawn-SS/p/7412274.html