Program to transpose a sparse matrix
#include #include #include #define MAX1 3 #define MAX2 3 struct sparse { int *sp ; int row ; } ; void initsparse ( struct sparse * ) ; void create_array ( struct sparse * ) ; void display ( struct sparse ) ; int count ( struct sparse ) ; void create_tuple ( struct sparse *, struct sparse ) ; void display_tuple ( struct sparse ) ; void transpose ( struct sparse *, struct sparse ) ; void display_transpose ( struct sparse ) ; void delsparse ( struct sparse * ) ; void main( ) { struct sparse s[3] ; int c, i ; for ( i = 0 ; i initsparse ( &s[i] ) ; clrscr( ) ; create_array ( &s[0] ) ; printf ( "\nElements in Sparse Matrix: " ) ; display ( s[0] ) ; c = count ( s[0] ) ; printf ( "\n\nNumber of non-zero elements: %d", c ) ; create_tuple ( &s[1], s[0] ) ; printf ( "\n\nArray of non-zero elements: " ) ; display_tuple ( s[1] ) ; transpose ( &s[2], s[1] ) ; printf ( "\n\nTranspose of array: " ) ; display_transpo...