Saturday, August 6, 2016

Matrix Transpose inplace

Inplace (Fixed space) M x N size matrix transpose
Given an M x N matrix, transpose the matrix without auxiliary memory.It is easy to transpose matrix using an auxiliary array. If the matrix is symmetric in size, we can transpose the matrix inplace by mirroring the 2D array across it’s diagonal (try yourself). How to transpose an arbitrary size matrix inplace? See the following matrix,

a b c       a d g j
d e f  ==>  b e h k
g h i       c f i l
j k l

http://www.geeksforgeeks.org/inplace-m-x-n-size-matrix-transpose/

1 comment:

  1. Nice explanation... Understood the concept... Thanks for sharing.

    Cheers,
    http://www.flowerbrackets.com/matrix-transpose-in-java/

    ReplyDelete