The program to find the transposition of a matrix is discussed here. Transpose of a matrix can be performed by exchanging the elements of a row by column and the elements of a column by row.
For example:
Input:nn1 2 3n4 5 6n7 8 9nnoutput:nn1 4 7n2 5 8n3 6 9nn
Algorithm:
Consider the matrix:
m[0][0] = 10
m[0][1] = 20
m[1][0] = 30
m[1][1] = 40
m[2][0] = 50
m[2][1]= 60
The transposition of the above matrix can be done by this way:
r_m[0][0] = m[0][0] = 10
r_m[0][1] = m[1][0] = 30
r_m[0][2] = m[2][0] = 50
r_m[1][0] = m[0][1] = 20
r_m[1][1] = m[1][1] = 40
r_m[1][2] = m[2][1] = 60
Asked in recruitment drive of Wipro.n
@@coding::1@@
Recommended Programs