The second method of representing a two-dimensional array in memory is the column major representation. Under this representation, the first column of the array occupies the first set of the memory locations reserved for the array. The second column occupies the next set and so forth. The schematic of a column major representation
Consider the following two-dimensional array:
a b c d
e f g h
i j k l
To make its equivalent column major representation, we perform the following process:
Transpose the elements of the array. Then, the representation will be same as that of the row major representation.
By application of above mentioned process, we get {a, e, i, b, f, j, c, g, k, d, h, i}
Col 0 | Col 1 | Col 2 | ......... | Col i |
0 comments:
Post a Comment
Let us know your responses and feedback