标签:
/* * 88. Merge Sorted Array * 12.6 by Mingyang */ public void merge(int[] A, int m, int[] B, int n) { int i = m - 1, j = n - 1, index = m + n - 1; while (i >= 0 && j >= 0) { if (A[i] > B[j]) { A[index--] = A[i--]; } else { A[index--] = B[j--]; } } while (i >= 0) { A[index--] = A[i--]; } while (j >= 0) { A[index--] = B[j--]; } }
标签:
原文地址:http://www.cnblogs.com/zmyvszk/p/5494794.html