தரவ கடடடமமபடப - சசதறசய அலடலத அடரடதடதசயறடற அணசகளட Data Structures- Sparse Matrix P Mahalakshmi
Data Structures- Sparse Matrix P Mahalakshmi
What is Sparse Matrix? ● A matrix can be defined with a 2-dimensional array. ● Any array with 'm' rows and 'n' columns represent a m X n matrix ● There may be a situation in which a matrix contains more number of ZERO values than NON-ZERO values. Such matrix is known as sparse matrix. ● Sparse matrix is a matrix which contains very few non-zero elements.
Example ● Consider a matrix of size 100 X 100 containing only 10 non-zero elements. ● In this matrix, only 10 spaces are filled with non-zero values and remaining spaces of the matrix are filled with zero. ● Totally we allocate 100 X 100 X 2 = 20000 bytes of space to store this integer matrix. ● To access these 10 non-zero elements we have to make scanning for 10000 times.
Sparse Matrix Representations ● Triplet Representation (Array Representation) ● Linked Representation
Triplet Representation (Array Representation) ● In this representation, we consider only non-zero values along with their row and column index values. ● the 0th row stores the total number of rows, total number of columns and the total number of non-zero values in the sparse matrix. ● For example, consider a matrix of size 5 X 6 containing 6 number of non-zero values.
Example 0th Row 0th column
Applications
References ● http://btechsmartclass.com/data_structures/sparse- matrix.html

sparse matrix in data structure

  • 1.
    தரவ கடடடமமபடப -சசதறசய அலடலத அடரடதடதசயறடற அணசகளட Data Structures- Sparse Matrix P Mahalakshmi
  • 2.
  • 3.
    What is SparseMatrix? ● A matrix can be defined with a 2-dimensional array. ● Any array with 'm' rows and 'n' columns represent a m X n matrix ● There may be a situation in which a matrix contains more number of ZERO values than NON-ZERO values. Such matrix is known as sparse matrix. ● Sparse matrix is a matrix which contains very few non-zero elements.
  • 4.
    Example ● Consider amatrix of size 100 X 100 containing only 10 non-zero elements. ● In this matrix, only 10 spaces are filled with non-zero values and remaining spaces of the matrix are filled with zero. ● Totally we allocate 100 X 100 X 2 = 20000 bytes of space to store this integer matrix. ● To access these 10 non-zero elements we have to make scanning for 10000 times.
  • 5.
    Sparse Matrix Representations ●Triplet Representation (Array Representation) ● Linked Representation
  • 6.
    Triplet Representation (Array Representation) ●In this representation, we consider only non-zero values along with their row and column index values. ● the 0th row stores the total number of rows, total number of columns and the total number of non-zero values in the sparse matrix. ● For example, consider a matrix of size 5 X 6 containing 6 number of non-zero values.
  • 7.
  • 8.
  • 9.