recategorized by
667 views
0 votes
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  



 

 

 

                                               

recategorized by

1 Answer

0 votes
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 )

Related questions

0 votes
0 votes
2 answers
1
viral8702 asked Sep 21, 2023
275 views
The Total Combinations Possible of Min heap with 8 Distinct elements are ?
0 votes
0 votes
1 answer
2
iamdeepakji asked Jan 27, 2019
266 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 votes
0 votes
1 answer
3
iamdeepakji asked Dec 27, 2018
385 views
Please solve this by taking some exampleBack edgecross edgetree edgeThankyou.
0 votes
0 votes
1 answer
4
aaru14 asked Dec 6, 2017
234 views
https://gateoverflow.in/?qa=blob&qa_blobid=12037309044418228871someone plz solve this question??