标签:pre void 有序 数组 int col div merge 有序数组
1.归并有序数组
归并A,B到A
public class Solution { public void merge(int A[], int m, int B[], int n) { int a = m-1, b = n-1; int i = A.length-1; while(a>=0 && b>=0){ if (A[a]>B[b]){ A[i--] = A[a--]; }else{ A[i--] = B[b--]; } } while(a>=0) A[i--] = A[a--]; while(b>=0) A[i--] = B[b--]; } }
标签:pre void 有序 数组 int col div merge 有序数组
原文地址:https://www.cnblogs.com/augenstern/p/13662794.html