Linked Questions

Popular Questions

Split Big Array Into Two Arrays

Asked by At

I have a big array of objects and would like to split it into two arrays containing the objects in alternate order.

Example:

[0, 1, 2, 3, 4, 5, 6]

Becomes these two arrays (they should alternate)

[0, 2, 4, 6] and [1, 3, 5]

There are a ton of ways to split an array. But, what is the most efficient (least costly) if the array is huge.

Related Questions