• recategorized by
1,038 views
0 0 votes

anyone please explain me how to find loc in lower triangular matrix , i am getting little bit confuse 

suppose matrix is          

                                               1     2       3        4

                                    1         a11   a12   a13   a14

                                     2       a21   a22   a23   a24

                                     3      a31   a32   a33   a34

                                     4     a41    a42   a43   a44

 

 

now i have to find location of a[4] b[3]:- given BA=1000 C=1

=1000+ [(4-1) * ((3)(4))/2 +(3-1)]*1

by this way i we get answer but  something wrong please exolplain  



 

 

 

                                               

1 Answer

0 0 votes

lower triangular matrix means elements which are above the diagonal are 0 ===> we need not to store them.

let your lower bound = 1, your Array is nXn, you want address of A[i][j].

1 row contains ------------>1 element ( A[1][1] )

2 row contains ------------>2 elements ( A[2][1], A[2][2] )

3 row contains ------------>3 elements ( A[3][1], A[3][2], A[3][3] )

.

.

(i-1)th row contains ------------>i-1 elements ( A[i-1][1], A[i-1][2], ............A[i-1][i-1] )

(i)th row contains ------------>i elements ( A[i][1], A[i][2], ............A[i][i] )

 

 

for reaching A[i][j], you have to cross i-1 rows ===> you are at required row

total elements up to (i-1)th row = 1+2+...+(i-1) = $\frac{(i-1)(i)}{(2)}$, you have to cross these elements to get required row

 

to get particular element A[i][j] in that row, you have to skip (j-1) elements.

Therefore total elements you have to skip =  $\frac{(i-1)(i)}{(2)}$ + (j-1)

to get that memory = BA + ( $\frac{(i-1)(i)}{(2)}$ + (j-1) ) * ( size of element )

Position:
Show:

Related questions

5 5 votes
0 0 answers
435
435 views
Kundan_Kumar asked Dec 15, 2024
435 views
Both array & linklist are sequential acces bus as per their requirments array is effieient for sequential acces & random acces but ,as linklist not that much efficient fo...
0 0 votes
2 2 answers
666
666 views
viral8702 asked Sep 21, 2023
666 views
The Total Combinations Possible of Min heap with 8 Distinct elements are ?
0 0 votes
1 1 answer
561
561 views
iamdeepakji asked Jan 27, 2019
561 views
If there is negative edge cycle then dijkstra algorithm will give correct path or not same thing about bellman ford also?Bellman ford always halts or not?
0 0 votes
1 1 answer
941
941 views
iamdeepakji asked Dec 27, 2018
941 views
Please solve this by taking some exampleBack edgecross edgetree edgeThankyou.