Posts

Showing posts with the label Program to store sparse matrix as a linked list

Program to store sparse matrix as a linked list

#include #include #include #define MAX1 3 #define MAX2 3 /* structure for col headnode */ struct cheadnode { int colno ; struct node *down ; struct cheadnode *next ; } ; /* structure for row headnode */ struct rheadnode { int rowno ; struct node * right ; struct rheadnode *next ; } ; /* structure for node to store element */ struct node { int row ; int col ; int val ; struct node *right ; struct node *down ; } ; /* structure for special headnode */ struct spmat { struct rheadnode *firstrow ; struct cheadnode *firstcol ; int noofrows ; int noofcols ; } ; struct sparse { int *sp ; int row ; struct spmat *smat ; struct cheadnode *chead[MAX2] ; struct rheadnode *rhead[MAX1] ; struct node *nd ; } ; void initsparse ( struct sparse * ) ; void create_array ( struct sparse * ) ; void display ( struct sparse ) ; int count ( struct sparse ) ; void create_triplet ( struct sparse *, struct sparse ) ; void create_llist ( struct sparse * ) ; void insert ( struct sparse *, struct...