Question

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]
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Let the address of A[lb1,lb2,lb3] be base address.

the size of data type of array be S.

Address(A[i,j,k]) =

first of all,we need to reach ith 2-D.for that we need to cross or skip all the 2-D's that came before.(i.e i-lb1) 2-D's need to be crossed to reach ith 2-D.

Once we have reached ith 2-D,we need to reach jth row.for that we need to cross all rows that came before jth row.i.e( j-lb2 ) rows .

Once we need have reached desired row we need to reach desired column of jth row.to do that we need to skip or cross all columns before that.i.e.(k - lb3) columns.

Size of one 2-D = (ub2 - lb2 + 1)*(ub3 - lb3 + 1)*S

Size of one row = (ub3 - lb3 + 1)*S

Address(A[i,j,k]) =

Base address +( i-lb1)*(ub2-lb2+1)*(ub3 - lb3 + 1)*S + (j-lb2)*(ub3- lb3 + 1)*S + (k - lb3)*S

Add a comment
Know the answer?
Add Answer to:
Develop have the (3. 15pts) Multidimensional arrays can be stored in row major order, as in...
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.

  • 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...

  • Please develop the following code using C programming and using the specific functions, instructi...

    Please develop the following code using C programming and using the specific functions, instructions and format given below. Again please use the functions given especially. Also don't copy any existing solution please write your own code. This is the first part of a series of two labs (Lab 7 and Lab 8) that will complete an implementation for a board-type game called Reversi (also called Othello). The goal of this lab is to write code that sets up the input...

  • hello there, i have to implement this on java processing. can someone please help me regarding...

    hello there, i have to implement this on java processing. can someone please help me regarding that? thanks War is the name of a popular children’s card game. There are many variants. After playing War with a friend for over an hour, they argue that this game must never end . However! You are convinced that it will end. As a budding computer scientist, you decide to build a simulator to find out for sure! You will implement the logic...

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