What is the name of this array transformation?

Posted by Brandon Tilley on Programmers See other posts from Programmers or by Brandon Tilley
Published on 2013-07-01T01:02:44Z Indexed on 2013/07/01 4:28 UTC
Read the original article Hit count: 225

Filed under:
|

Start with an array of arrays; in this case, they are different lengths in order to demonstrate the technique, but they do not have to be.

[[1,2,3,4], [5,6,7], [8,9,10], [11,12,13,14,15]]

At the other end of the transformation, you have an array of arrays where the first array contains the first element from each of the original arrays, the second array contains the second element from each of the original arrays, and so on.

[[1,5,8,11], [2,6,9,12], [3,7,10,13], [4,14], [15]]

Is there a mathematical or CS term for this operation?

© Programmers or respective owner

Related posts about algorithms

Related posts about array