Tagged: matrix

Print Matrix in Spiral Order

“Print Matrix in Spiral Order” is a standard interview problem based on matrix data structure which have been asked in many technical and algorithmic interviews.  Here, we are given a matrix of size N*M and our task is to print the following matrix in spiral Order. Example: INPUT: N=3, M=3...

Print Matrix in zig-zag order

“Print Matrix in zig-zag order” is a a problem of printing the given  matrix of size N*M in zig-zag order.  The zig-zag order of the matrix is traversing the first row of matrix from left to right, next row from right to left, next row from left to right and so...

Sort the Matrix

“Sort the matrix” is a standard interview problem which has been asked in many technical and algorithmic interview. Here, we are given a matrix of size N*N. Our task is to write a program to sort the given matrix such that all the elements of all rows are sorted and...

blank

Check Idempotent Matrix

“Check Idempotent Matrix” is a problem of matrix where we need to check whether given matrix is an idempotent matrix or not. There are basically three different types of matrix: Identity Matrix: An identity matrix is a square matrix of size N*N which have all the diagonal element as 1 and...

blank

Check Involuntary Matrix

“Check Involuntary Matrix” is a basic problem of matrix where we need to check whether given matrix is an involuntary matrix or not. There are basically three different types of matrix: Identity Matrix: An identity matrix is a square matrix of size N*N which have all the diagonal element as 1...

blank

Check Identity Matrix

“Check Identity Matrix” is a problem of matrix, where we need to check whether given matrix is an identity matrix or not. There are basically three different types of matrix: Identity Matrix: An identity matrix is a square matrix of size N*N which have all the diagonal element as 1 and...

blank

Multiply Two Matrix

“Multiply two matrix” is a standard operation which can be applied over two or more matrices. Here, we are given two matrices of dimension r1*c1 and r2*c2 respectively. Our task is to multiply the following matrices and store the result in resultant matrix. CONDITION : The two matrices can only be added if the...

blank

Transpose of a Matrix

“Transpose of a matrix” is a basic problem on matrix where we interchange the row and columns with each other. Here, we are given a matrix of size N*M and our task is to find the transpose of the matrix by interchanging the row and columns. The resultant matrix will...

blank

Add Two Matrix

“Add Two Matrix” is a basic operation which can be applied over two or more matrices. Here, we have given two matrices of dimension N*M and our task is to add the following matrices and store the result in resultant matrix. CONDITION: The dimensions of the matrices to be added...