Page 87 - DCAP201_FUNDAMENTALS_OF_DATA_STRUCTURES
P. 87

Fundamentals of Data Structures




                    Notes          Self Assessment

                                   State whether the following statements are true or false:
                                   1.  A function which deletes an element removes the element and returns the index of the last
                                       element.

                                   2.  Array insertion mean increasing size of array.

                                   6.2 Sparse Matrices and their Storage

                                   Matrices with good number of zero entries are called sparse matrices. A sparse matrix is a matrix
                                   that allows special techniques to take advantage of the large number of zero elements. Sparse
                                   matrix is very useful in engineering field, when solving the partial differentiation equations.

                                                   Figure 6.1: (a) Triangular Matrix (b) Tridiagonal Matrix













                                                        (a)                          (b)

                                   A triangular matrix is a square matrix in which all the elements either above or below the main
                                   diagonal are zero. Triangular matrices are sparse matrices. A tridiagonal matrix is a square
                                   matrix in which all the elements except for the main diagonal, diagonals on the immediate
                                   upper and lower side are zeroes. Tridiagonal matrices are also sparse matrices.

                                   Let us consider a sparse matrix from storage point of view. Suppose that the entire sparse matrix
                                   is stored. Then, a considerable amount of memory which stores the matrix consists of zeroes.
                                   This is nothing but wastage of memory. In real life applications, such wastage may count to
                                   megabytes. So, an efficient method of storing sparse matrices has to be looked into.


                                          Example: Figure 6.2 shows a sparse matrix of order 7 × 6.

                                                 Figure 6.2: Representation of a Sparse Matrix of Order 7 × 6























          80                                LOVELY PROFESSIONAL UNIVERSITY
   82   83   84   85   86   87   88   89   90   91   92