C Program for Finding Transpose of a Sparse Matrix

Here you will get C program to find transpose of a sparse matrix.
Transpose of a matrix is obtained by interchanging rows and columns. In another way, we can say that element in the i, j position gets put in the j, i position. Transpose  of the matrix B1 is obtained as B2 by inserting (i,j)th element of B1 as (j,i)th element in B2.

 

Output

Enter the size of matrix (rows,columns):3 4

Enter no. of non-zero elements:4

Enter the next triple(row,column,value):1 0 5

Enter the next triple(row,column,value):1 2 3

Enter the next triple(row,column,value):2 1 1

Enter the next triple(row,column,value):2 3 2

After Transpose:

row column value
4 3 4
0 1 5
1 2 1
2 1 3
3 2 2

2 thoughts on “C Program for Finding Transpose of a Sparse Matrix

Leave a Reply

Your email address will not be published. Required fields are marked *