There are 2 arrays filled with data. Take a concrete example without abstraction. In one array there are 2 elements, in the other - 4. Elements are not repeated.
int[] a = new int[] { a1, a2, }; int[] b = new int[] { b3, b4, b5, b6, }; int[] c = new int[] { 0, 0, 0, 0, 0, 0, };
It is necessary to fill 3 array with this data. It doesn't matter whether to create a new array of length 6 or use this one. The task is to assign the elements of the array to certain indices of the array с
.
For example, put them in s [1] and s [3]:
int[] c = new int[] {0, a1, 0, a2, 0, 0, };
And a similar operation to do with the array b
. Those. put its elements in the positions of another array that I previously determined:
int[] c = new int[] { b3, a1, b4, a2, b5, b6, };
Complexity is not so important, there are not many elements. Interested in at least an approximate algorithm, or the correct approach to the solution.
int[] c = new int[6]; c[1] = a[0]; c[3] = a[1]
int[] c = new int[6]; c[1] = a[0]; c[3] = a[1]
int[] c = new int[6]; c[1] = a[0]; c[3] = a[1]
? - Regent