too late... use assembly's command: xchg
Just sort the array (in place using QuickSort, supported by any good library) but use
reversed key values, thus: it will sort as:
1a, 1b, 2a, 2b etc - of course reverse order only to be used for key comparison purposes, it won't be changed in the array: there job done in less than few minutes.
Of course in reality the solution should be more effective - you don't really need to swap them and trash processor cache - you need to think what you will do with the data later, say if its saving in such a state on disk then you can just do it in simple loop with counter plus fixed offset thus merging two sorted streams on the fly.
And if you need array with changed places for some later processing then you can do similar merging on the fly.
All in all stupid task that is only excusable by separating pros (who will solve it in 1 minute using existing tools) from amateurs who will actually be stupid enough to follow artificial rules instead of just bending the spoon.
If they don't like it then I'd walk out.