































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An overview of memory storage for one-dimensional and two-dimensional arrays, including the concepts of row-major and column-major order. It also explains the formula for computing the address of an element in a one-dimensional array and the general formula for computing the address of an element in a two-dimensional array. The document further discusses special forms of square matrices, such as diagonal, tridiagonal, lower triangular, upper triangular, and symmetric matrices, and how they can be efficiently represented in memory. It includes examples and algorithms for various array operations like insertion, deletion, and searching. Important topics in data structures and algorithms, particularly related to the representation and manipulation of arrays, which are fundamental data structures in computer science.
Typology: Summaries
1 / 71
This page cannot be seen from the preview
Don't miss anything!
student[1]
student[0] student[2]
student[3]
marks[1]
marks[0] marks[2]
(0,0) (0,1) (0,2) (0,3) (0,4) (1,0) (1,1) (1,2) (1,3) (1,4) (2,0) (2,1) (2,2) (2,3) (2,4)
(0,0) (^) (1,0) (2,0) (0,1) (^) (1,1) (2,1) (0,2) (^) (1,2) (2,2) (0,3) (^) (1,3) (2,3) (0,4) (^) (1,4) (2,4)
Given: B = 100, W = 4, and LB = 0
A[0] = 100 + 4 * (0 – 0) = 100
Given:
B = 100, W = 4, and LB = 0 A[1] = 100 + 4 * (1 – 0) = 104 A[2] = 100 + 4 * (2 – 0) = 108 A[3] = 100 + 4 * (3 – 0) = 112 A[4] = 100 + 4 * (4 – 0) = 116 A[5] = 100 + 4 * (5 – 0) = 120
B = Base address/address of first element, i.e. A[LBR][LBC] I = Row subscript of element whose address is to be found J = Column subscript of element whose address is to be found W = Number of bytes used to store a single array element LBR = Lower limit of row/start row index of matrix, if not given assume 0 LBC = Lower limit of column/start column index of matrix, if not given assume 0 N = Number of column of the given matrix M = Number of row of the given matrix
[0] [1] [2] [3] [0] (^1 2 3 ) [1] (^5 6 7 ) [2] (^9 10 11 )
Row-major
Address of A[I][J] = B + W * ( N * ( I – LBR ) + ( J – LBC ))
Address of A[2][1] = B + W * (4 * (2 – 0) + (1 – 0))
M = 3 N = 4
Address of A[2][1] = B + W * (4 * (2 – 0) + (1 – 0))
Address of A[2][1] = B + W * (4 * (2 – 0) + (1 – 0))
Address of A[2][1] = B + W * (4 * (2 – 0) + (1 – 0))
Address of A[I][J] = B + W * ( N * ( I – LBR ) + ( J – LBC ))
Address of A[I][J] = B + W * ( N * ( I – LBR ) + ( J – LBC ))
Address of A[I][J] = B + W * ( N * ( I – LBR ) + ( J – LBC ))
the address of the first element is 49. Find the address of the element A[4][3] when the storage is row major. Address of A[I][J] = B + W * ( N * ( I – LBR ) + ( J – LBC ))
LBC = 0. Address of A[4][3] = 49 + 4 * (5 * (4 – 0) + (3 - 0)) = 49 + 4 * (23) = 49 + 92 = 141