



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
The concept of sparse matrices, which have a large number of zero elements compared to nonzero elements. The inefficiency of storing sparse matrices in a traditional n x n array and proposes an alternative: circular lists that store only nonzero elements. The document also provides a detailed implementation of a sparse matrix data structure using a circular linked list. A sample matrix and an instruction to create it.
Typology: Slides
1 / 6
This page cannot be seen from the preview
Don't miss anything!




Sparse Matrices
−
−
0 0 0 15
0 4 0 0
12 5 0 0
0 0 11 0
Circular linked list
Linked Representation for Matrix
#define MAX_SIZE 50 /* size of largest matrix */ typedef enum {head, entry} tagfield; typedef struct matrix_node *matrix_pointer; typedef struct entry_node { int row; int col; int value; }; typedef struct matrix_node { matrix_pointer down; matrix_pointer right; tagfield tag; union { matrix_pointer next; entry_node entry; } u; }; matrix_pointer hdnode[MAX_SIZE];