3,022 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

15.7k
views
3 answers
16 votes
shikharV asked Dec 4, 2015
15,689 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.4k
views
1 answers
2 votes
shikharV asked Nov 16, 2015
2,409 views
Please solve the above problem. Given answer: D
543
views
1 answers
0 votes
viral8702 asked Apr 29, 2022
543 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)?...
1.9k
views
1 answers
1 votes
iarnav asked Apr 28, 2017
1,869 views
Let's say we have an array of 5 elements.Array index starts from 0 Base address of Array = 100 size of each element is 2 ie it's an int arrayNow we want to find the 2nd e...