递归:
public int[] sortArray(int[] nums){
int[] dst=new int[nums.length];
dst=Arrays.copyOf(nums,nums.length);
mergeSort(nums,dst,0,nums.length);
return dst;
}
private void mergeSort (int[] src,int[] dst,int start,int end){
if (start+1>=end)
return;
int mid=(start+end)/2;
mergeSort(dst,src,start,mid);
mergeSort(dst,src,mid,end);
int i=start,j=mid,k=start;
while (i
非递归
public int[] sortArray(int[] nums){
int length=nums.length;
int[] src=nums;
int[] dst=new int[length];
for (int seg=1;seg 


