775 views
3 votes
3 votes

Consider a two-dimensional array with elements stored in the form of lower triangular matrix. The elements must be crossed to read A[4, 2] from the array A[–6, ..., + 8, –6,..., + 8] whose base address 1000 is ________. (Assume elements are stored in row major order)

1 Answer

3 votes
3 votes

OR

If we take the size of each element as 1 bytes. 

Then its actually asking for the address of A[4][2] in the lower triangular matrix.

In Row Major Order, A[i][j] = Base + Size( (i - lower1) *NNS + (j-lower2) )     //NNS = Natural No.Sum.

So, A[4][2] 1000 + 1 ( ( 4-(-6) )*NNS + (2-(-6) ) )

                  = 1000 + (1+2+3+4+5+6+7+8+9+10) + 8

                  = 1000 + 55 + 8

                  = 1063

Related questions

0 votes
0 votes
1 answer
3
kickassakash asked Jul 4, 2023
425 views
I have specific doubt on this question and I’ve tried to explain that in the picture ,If anyone can explain it then it’ll be of great help. according to sachin sir th...
0 votes
0 votes
1 answer
4
Souvik33 asked Apr 2, 2023
435 views
There are Insert and Retrieve_Max operations on a set {}. for n such operations what is the time complexity of the efficient algorithm possible?$n^{2}$nlogn n logn