array interleaving problem

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2009-11-22T05:26:44Z Indexed on 2010/04/08 6:23 UTC
Read the original article Hit count: 448

Filed under:
|

I was looking for something over the web when I came across this question. Have no idea of how to solve it. Help me out please.

Suppose we have an array a1,a2,... ,an, b1,b2,..., bn

How to change this array to a1,b1,a2,b2, ..., an,bn in O(n) time and in O(1) space.

© Stack Overflow or respective owner

Related posts about arrays

Related posts about algorithm