Question

Multidimensional arrays can be stored in row major order or in column major order. The access...

Multidimensional arrays can be stored in row major order or in column major order. The access function computes the address of an element in the array. What are the access functions for both of these arrangements for 3-D arrays? Assume the name of the array is A, EACH ARRAY INDEX STARTS AT INDEX 0. The number of rows is r, the number of columns is c, and the access function computes the address of the element A[i][j][k].

row major order: address (A[i, j, k]) =

column major order: address (A[i, j, k]) =

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ROW MAJOR
The address of A[i][j][k] = BA + width * {[(k - k0) * R * C] + [(i - i0) * C] + (j - j0)]}

where,
   i0 is starting row index
   i is the current row index
   j0 is the starting column index
   j is the current column index
   k0 is the starting frame
   k is the current frame
   R is the total number of rows
   C is the total number of columns
   width is the size of each element
   BA is the bases address of the array


COLUMN MAJOR
The address of A[i][j][k] = BA + width * {[(k - k0) * R * C] + [(j - j0) * R] + (i - i0)]}

where,
   i0 is starting row index
   i is the current row index
   j0 is the starting column index
   j is the current column index
   k0 is the starting frame
   k is the current frame
   R is the total number of rows
   C is the total number of columns
   width is the size of each element
   BA is the bases address of the array

Add a comment
Know the answer?
Add Answer to:
Multidimensional arrays can be stored in row major order or in column major order. The access...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Multidimensional arrays can be stored in row major order, as in C++, or in column major...

    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 arrays. Please explain step my step.

  • Develop have the (3. 15pts) Multidimensional arrays can be stored in row major order, as in...

    Develop have the (3. 15pts) Multidimensional arrays can be stored in row major order, as in C++. the access function for the row-major arrangement of three-dimensional arrays that following form: A[1b1. .ub1, 1b2. .ub2, 1b3. u and upper bounds for the respective dimensions of the array. Define the access function that a ub3], where lb and ubs represent the lower compiler needs to implement to compute the address of Al[i.j.K]. Address(ADJ.K]

  • Three dimensional arrays can be stored in row major order, as in C++. Develop the access...

    Three dimensional arrays can be stored in row major order, as in C++. Develop the access function for row major arrangement for three-dimensional arrays. Assume the lower boundaries of the three dimensions are min(1), min(2) and min(3) respectively. Also assume the size of the three dimensions are size(1), size(2) and size(3) respectively. Assume the size of each element is one(1) to simplify the problem. The access function is to find the location of element a(i, j, k), i.e. location(a[i,j,k]) please...

  • Hello, Suppose a homogeneous array with 8 rows and 6 columns is stored in column major...

    Hello, Suppose a homogeneous array with 8 rows and 6 columns is stored in column major order starting at address 20 (base ten). If each entry in the array requires only one memory cell, what is the address of the entry in the third row and fourth column? What if each entry requires two memory cells? What is the meaning of address 20 base ten? how I can drwa the array? Thanks,

  • Write a menu based program implementing the following functions: (0) Write a function called displayMenu that...

    Write a menu based program implementing the following functions: (0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following: a do/while loop with the displayMenu function call inside the loop body switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu. the do/while loop should always continue as long...

  • Program in C++! Thank you in advance! Write a menu based program implementing the following functions: (1) Write a funct...

    Program in C++! Thank you in advance! Write a menu based program implementing the following functions: (1) Write a function that prompts the user for the name of a file to output as a text file that will hold a two dimensional array of the long double data type. Have the user specify the number of rows and the number of columns for the two dimensional array. Have the user enter the values for each row and column element in...

  • An m×n array A of real numbers is a Monge array if for all i,j,k, and l such that 1≤i<k≤m and ...

    An m×n array A of real numbers is a Monge array if for all i,j,k, and l such that 1≤i<k≤m and 1≤j<l≤n , we have >A[i,j]+a[k,l]≤A[i,l]+A[k,j]> In other words, whenever we pick two rows and two columns of a Monge array and consider the four elements at the intersections of the rows and columns, the sum of the upper-left and lower-right elements is less than or equal to the sum of the lower-left and upper-right elements. For example, the following...

  • 1. Write a MATLAB function that takes a matrix, a row number and a scalar as...

    1. Write a MATLAB function that takes a matrix, a row number and a scalar as arguments and multiplies each element of the row of the matrix by the scalar returning the updated matrix. 2. Write a MATLAB function that takes a matrix, two row numbers and a scalar as arguments and returns a matrix with a linear combination of the rows. For example, if the rows passed to the function were i and j and the scalar was m,...

  • java To access the element at row i and column / of a two-dimensional array named...

    java To access the element at row i and column / of a two-dimensional array named grades, we would use which of the following? O grades01 O grades(1) grades grades[J] QUESTION 6 Which of the following are errors in this syntax declaring a two-dimensional array? datatype [4) (0] [3] arrayNam: The brackets must be empty There must be two brackets, not three The syntax must end in a semicolon, not a colon All of these are errors in the syntax

  • how do i do this in basic java without using hashmat or anything complicated Two-Dimensional Arrays....

    how do i do this in basic java without using hashmat or anything complicated Two-Dimensional Arrays. Write the three functions described below. Demonstrate that your code works by calling each function and printing out the results. All of your code should be in one file. Upload your java code and a file containing the output of running your program to show that it works. Write a function called create2DIntArray that creates a two-dimensional array of integers between 0 and 10....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT