how to put all odd number in left an even number in right on array

  arr, arraylist, arrays, c++, sorting

Given two arrays of integers A and B of sizes N and M respectively. Write a function named MIX with four arguments, which will produce and return a third array named C. such that the following sequence is followed.

-All odd numbers of A from left to right are copied into C from left to right

-All eve numbers of A from left to right are copied into C from right to left.

Sample #1

Input

6 7
3 2 1 7 6 3
9 3 5 6 2 8 10

Output

3 1 7 3 9 3 5 10 8 2 6 6 2

code in c++

Source: Windows Questions C++

LEAVE A COMMENT