2 2 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) Data Structures + – mohitbawankar 1.2k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
3 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 Sandeep Suri answered Jan 15, 2018 Sandeep Suri comment Share Follow See all 2 Comments 2 2 Comments reply Balaji Jegan commented Jan 15, 2018 i edited by Balaji Jegan Jun 13, 2018 reply Follow flag why do we use Natural No.Sum ? 0 0 replyShare mohitbawankar commented Jan 15, 2018 reply Follow flag why you use NSS why not ub2-lb2+1 i.e.1000+150+8? 1 1 replyShare Please log in or register to add a comment.