2,894 views
1 votes
1 votes

Consider array A[1..100,1..100],in which elements are stored in Z representation. An example of 5x5 such array is shown below: 

Base address of array = 1000,size of each element is 1 Byte,and stored in row major, then address of A[100][50] ?

1 Answer

3 votes
3 votes
As per the question, RMO is used

therefore the matrix will look like

A[1][1]  A[1][2] ....................................  A[1][100]

                                                             A[2][99]

                                                       A[3][98]

                                             .

                                    .     

                              .

          A[98][3]

      A[99][2]

A[100][1]   A[100][2] ...............................A[100][100]

We want to go to element A[100][50]

means we need Row=100 and column=50

row1 has all 100 elements

row2 to 98 have 1 element only

row 100 has all 100 elements

therefore RMO = base + cross row1 + cross elements of row 2 to 98 + cross 49 elements in row 100 to reach 50th element

                          =  1000 + 100 + 98 + 49

                         =  1247Bytes?

Related questions

16 votes
16 votes
3 answers
1
shikharV asked Dec 4, 2015
15,491 views
A is an array $[2.....6, 2.....8, 2.......10]$ of elements. The starting location is $500$. The location of an element $A(5, 5, 5)$ using column major order is __________...
2 votes
2 votes
1 answer
2
shikharV asked Nov 16, 2015
2,321 views
Please solve the above problem. Given answer: D
0 votes
0 votes
1 answer
3
viral8702 asked Apr 29, 2022
451 views
A frame buffer array is addressed in row major order for a monitor with pixel locations starting from (0,0) and ending with (100,100). What is address of the pixel(6,10)?...