- - - figure - lower-triangular matrix there are two types of sparse matrices in the first type of sparse matrixall elements above the main diagonal have zero value this type of sparse matrix is also called (lowertriagonal matrix because if you see it pictoriallyall the elements with non-zero value appear below the diagonal in lower triangular matrixai, where an yn lower-triangular matrix has one non-zero element in the first rowtwo non-zero elements in the second row and likewise non-zero elements in the nth row look at fig which shows lower-triangular matrix to store lower-triangular matrix efficiently in the memorywe can use one-dimensional array which stores only non-zero elements the mapping between two-dimensional matrix and one-dimensional array can be done in any one of the following ways(arow-wise mapping--here the contents of array [will be { - - - figure upper-triangular (bcolumn-wise mapping--here the contents of array [will be matrix { - - - in an upper-triangular matrixai, where an yn upper-triangular matrix has non-zero elements in the first rown- non-zero elements in the second row and likewise one non-zero element in the nth row look at fig which shows an upper-triangular matrix there is another variant of sparse matrixin which elements with non-zero value can appear only on the diagonal or immediately above or below the diagonal this type of matrix is also called tri-diagonal matrix figure tri-diagonal hence in tridiagonal matrixai, where | in tridiagonal matrix matrixif elements are present on (athe main diagonalit contains non-zero elements for = in allthere will be elements (bbelow the main diagonalit contains non-zero elements for = + in allthere will be - elements (cabove the main diagonalit contains non-zero elements for = - in allthere will be - elements figure shows tri-diagonal matrix to store tri-diagonal matrix efficiently in the memorywe can use one-dimensional array that stores only non-zero elements the mapping between two-dimensional matrix and one-dimensional array can be done in any one of the following ways(arow-wise mapping--here the contents of array [will be { (bcolumn-wise mapping--here the contents of array [will be { (cdiagonal-wise mapping--here the contents of array [will be { applications of arrays arrays are frequently used in cas they have number of useful applications these applications are arrays are widely used to implement mathematical vectorsmatricesand other kinds of rectangular tables many databases include one-dimensional arrays whose elements are records arrays are also used to implement other data structures such as stringsstacksqueuesheapsand hash tables we will read about these data structures in the subsequent arrays can be used for sorting elements in ascending or descending order