# Matrices: Two-Dimensional Cartesian Structures

One of the problems of storing data in a matrix (a two-dimensional Cartesian structure) is that if not all of the elements are used, there might be quite a waste of space. In order to handle this, we can use a construct called a "sparse matrix", where only the active elements appear. Each such element is accompanied by its two indexes (the row and the column). Discuss in what ways such a structure is similar to and/or different than a list.

© BrainMass Inc. brainmass.com October 9, 2019, 8:53 pm ad1c9bdddfhttps://brainmass.com/computer-science/linked-lists/two-dimensional-cartesian-structure-165938

#### Solution Preview

The structure of a sparse matrix can be defined as follows (using C/C++ syntax)

struct Sparse {

int element; // This is the content of the element

struct Sparse *nextRow; // A pointer to the next row element

struct Sparse *nextCol; // A pointer to the next column element

int row; // The index of row

int column; // The ...

#### Solution Summary

This solution answers questions regarding data storage in a matrix.