Switch the array places in a loop

You don’t actually need to remember the next available element if you are smart with indexing. From a[] index is i*2 and from b[] index is i*2+1. That’s actually how even and odd numbers are defined in mathematics.

2 Likes