Algorithm and Flowchart to Find transpose of a matrix

[25882 views]


Algorithm to find transpose of a matrix

Transpose of a matrix is obtained by changing rows to columns and columns to rows. It is denoted by AT

Algorithm to find transpose of a matrix

Flowchart to find transpose of a matrix

Flowchart to find transpose of a matrix
Remove WaterMark from Above Flowchart

Pseudocode to find transpose of a matrix

Step 1: Start Step 2: Declare matrix a[m][n] of order mxn Step 3: Read matrix a[m][n] from User Step 4: Declare matrix b[m][n] of order mxn Step 5: // Transposing the Matrix 5.1: Declare variables i, j 5.2: Set i=0, j=0 5.3: Repeat until i < n 5.3.1: Repeat until j < m 5.3.1.1: b[i][j] = a[j][i] 5.3.1.2: j=j+1 // Increment j by 1 5.3.2: i=i+1 // Increment i by 1 5.4: Print matrix b // The matrix b is the transpose of a and can be printed now Step 6: Stop

In the above algorithm,

  1. We first declare two matrices a and b of order mxn
  2. Then we read matrix a from the user. We will use matrix b to store transpose of the matrix.
  3. Now, we declare two variables i, j and initialize them to 0
  4. After this we start a loop of i, till it reaches n which gave us the column indexes and inside it a loop of j which gives us the elements of the row.
The statement b[i][j] = a[j][i] gives the value of a by changing the row to column and column to row and stores in b. for e.g. i=1, j=2 then b[1][2]=a[2][1], thus assigning the matrix b to the transpose of a.

Recommended:

        

Having Difficulty understanding above Algorithm and Flowchart? Buy Our Notes



Are You Good enough in Algorithms? Test your Skills


Comments

1 comment
  • C.kokilavani

    I want program in c programs books in gmail please send the book



Search
Recommended Deals End in










Recommended Quiz
Online Games
Play 2048 Game Online and Relax.
Play 2048 Game Online

Search Tags

    Pseudocode for transpose of a matrix