edited by
1,164 views
1 votes
1 votes

https://gateoverflow.in/32836/location-of-element-using-row-major-order
A[5.....15,-8.....8] is A[11][17] and we are supposed to find A[8][5]  - Row Major Order Base Address:800, each element occupies 4 memory cells, then this is my analysis please let me know where im going wrong

A[11][17], we need to find A[8][5] in row major, this means 7 rows have been traversed already with each row containing 17 elements
=>(7*17)*4 = 476

Now we are in the 8th row we need to go to column 5 => 5*4=20

476+20=496

496+BaseAddress=496+800=1296

This question is already asked multiple times before, but i have an issue understanding something, the answer is no where close to mine and i know by application for formula, we can arrive at the answer, but i need to understand what im doing wrong here
Thanks

edited by

1 Answer

Best answer
1 votes
1 votes
here rows starting from 5 not from 0 or 1.so from 5 to reach 8 we have to cross only 3 rows (5,6,7) with 17 elements in each row.after crossing 51 elements now we are in 8th row .in 8th row we want to go from -8 to 5 only.not cross 5.so 13 elements in 8th row.

so total elements crossed by us are 51+13=64 and each of size 4 so 64*4=256.now add base-address(800) +256 =1056
selected by

Related questions

0 votes
0 votes
2 answers
1
worst_engineer asked Dec 29, 2015
3,827 views
My question is : in the row [8][-8] to [8][5] will be 5-(-8)+1 = 14 elements , right ? so , it should be 1060 then considering 4 Byte is one element.I know , this is pret...
0 votes
0 votes
1 answer
2
viral8702 asked Apr 29, 2022
493 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)?...
6 votes
6 votes
0 answers
3
V pandey asked Oct 8, 2022
3,058 views
Consider a multi-dimensional array A [90][30]40] with base address start at 1000, calculate the address of A[10][20][3] in row major order and column major order. Assume ...
0 votes
0 votes
2 answers
4
srestha asked Oct 29, 2017
939 views
An array A[10][20] starts at decimal address 1000. Each element of array occupies 1 B and array is stored in row major order. Compute address of A[5][6]just give the outp...