Given sorted arrays of length n and 2n with n elements each, merge first array into second array.
Sigiloso
Well, I assume that the values in the second array of length 2n is in the first n slots. void merge(int[] a, int[] b) { int i = a.length - 1; int j = i; int k = b.length - 1; while (i >= 0 && j >= 0) { if (a[i] > b[j]) { b[k] = a[i]; i--; } else { b[k] = b[j]; j--; } k--; } while (i >= 0) { b[k] = a[i]; i--; k--; } }