public static void merge(int[]arr,int L,int M,int R){ int[]help=new int[R-L+1]; int i=0; int p1=L; int p2=M+1; while(p1<=M && p2<=R){ help[i++]=arr[p1]<=arr[p2]?arr[p1++]:arr[p2++]; } while(p1<=M){ help[i++]=arr[p1++]; } while(p2<=R){ help[i++]=arr[p2++]; } for(i=0;i<help.length;i++){ arr[L+i]=help[i]; } }
标签:p2,归并,p1,help,int,排序 From: https://www.cnblogs.com/ztzzh-1/p/17540569.html