Jan 17, 2009

If a 2-d matrix were to be represented in (a) row-major order and (b) column-major order, what would be the corresponding index given the indices of t

If a 2-d matrix were to be represented in (a) row-major order and (b) column-major order, what would be the corresponding index given the indices of the 2-d matrix?
Suppose the matrix is mxn, we want to access a[x][y]
Row-major order: x*n+y
Col-major order: y*m+x

No comments:

Post a Comment