As I’m working on an API that returns matrices of solutions in its responses, I’m finding Wikipedia’s definitions for some of the concepts I’m trying to express quite handy.
Methods for ordering & storing multidimensional arrays fall into the bucket, as I’ve struggled to figure out how to express a matrix in JDK 1.5 (1-D Array? 2-D Array? List of Lists? Map?).

It turns out that there are two fundamental ways to store multidimensional matrices in linear memory - Row-major & Column-major. They’re not that different from each other (in fact, they’re transpositions of each other), but it’s nice to attach a proper name to the concept.

1  2  3
4  5  6

In row-major storage, a multidimensional array in linear memory is accessed such that rows are stored one after the other. It is the approach used by the C programming language as well as many other languages, with the notable exception of Fortran.

1  2  3  4  5  6

Column-major order is a similar method of flattening arrays onto linear memory, but the columns are listed in sequence. The programming language Fortran uses column-major ordering.

1  4  2  5  3  6