edited by
2,539 views
0 votes
0 votes
In a lower triangular matrices (size 15 x 15) representation of compact single
dimensional array, non-zero elements (i.e. elements of the lower triangle) of each row are stored one after another, starting from the first row. Assume each integer take 1B. The array stored in row major order and first element of array is stored at location 1000, then the address of element a[10] [6] is______ B.

[Note: Only lower triangular elements of the matrix are stored in contiguous array]
edited by

1 Answer

5 votes
5 votes

$a[1....15][1....15]$

$BA=1000$

$Size\ of\ element=1\ B$

$Loc[10][6]$

$\\ =1000+\left \{\underbrace {10-1=9}+(6-1) \right \}\times 1B$

                    $Natural\ \#\ sum\\ of\ 9\ rows$

$=1000+\left \{ \dfrac{9\times 10}{2}\ +\ 5 \right \}\times 1B$

$=1000+\left \{ 45+5 \right \}\times 1B$

$=1050B$


$a[0....14][0....14]$

$BA=1000$

$Size\ of\ element=1\ B$

$Loc[10][6]$

$\\ =1000+\left \{\underbrace {10-0=10}+(6-0) \right \}\times 1B$

                    $Natural\ \#\ sum\\ of\ 10\ rows$

$=1000+\left \{ \dfrac{10\times 11}{2}\ +\ 6 \right \}\times 1B$

$=1000+\left \{ 55+6 \right \}\times 1B$

$=1061B$

Related questions

1 votes
1 votes
2 answers
2
Shamim Ahmed asked Dec 11, 2018
1,187 views
Given a 2D array A[40….95, 40...95] in lower triangular representation, size of each element is 1 ByteArray implemented in row major order, base address is 1000Address ...
1 votes
1 votes
1 answer
3
shivangi5 asked Dec 12, 2017
633 views
Options areTI==(P/Q*i-1)Ti==(P/Q*i+1)Ti==(P/Q*(i-1)-1)Ti==(P/Q*(i+1)-1)
2 votes
2 votes
0 answers
4