const int SIZE = 10; void merge(double s1[], double s2[], double target[]) { int i; // Loop control variable for (i = 0; i < SIZE; i++) { target[i] = s1[i]; } for (i = 0; i < SIZE; i++) { target[i + SIZE] = s2[i]; } } void interleave(double s1[], double s2[], double target[]) { int i; // Loop control variable for (i = 0; i < SIZE; i++) { // s1[0] goes to target[0] // s1[1] goes to target[2] // s1[2] goes to target[4] // s1[3] goes to target[6] // In general: s1[i] goes to target[2*i] target[2*i] = s1[i]; } for (i = 0; i < SIZE; i++) { // s2[0] goes to target[1] // s2[1] goes to target[3] // s2[2] goes to target[5] // s2[3] goes to target[7] // In general: s1[i] goes to target[2*i + 1] target[2*i + 1] = s2[i]; } }