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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started