Question: Multidimensional arrays can be stored in row major order, as in C++, or in column major order, as in Fortran. Develop the access functions for

Multidimensional arrays can be stored in row major order, as in C++, or in column major order, as in Fortran. Develop the access functions for both of these arrangements for three-dimensional array.

Let the subscript ranges of the three dimensions be named min(1), min(2), min(3), max(1), max(2), and max(3). Let the sizes of the subscript ranges be size(1), size(2), and size(3). Assume the element size is 1.

Row Major Order: location(a[i,j,k]) = (address of a[min(1),min(2),min(3)]) +((i-min(1))*size(3) + (j-min(2)))*size(2) + (k-min(3))

Explain why the answer for row major order is this?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!