Unique sort order of array c++
<p>How would I sort an array of integers (0,1,2,3,4,5) in a monge shuffle type order (greatest odd to least odd, then least even to greatest even) like (5,3,1,0,2,4). Im having trouble trying to solve this problem.</p>

<p>Ive tried so far: </p>

<pre><code>void mongeShuffle(int A[], int B[], int size)
{
    int i = 0; // i is the index of the arr
    while(i &lt; size)
    {
        if(A[i] % 2 == 1)
        {
            B[i] = A[i];
            i++;
        }
        else
        {
            B[i] = A[i -1];
            i++;
        }
    }
}
</code></pre>
