# Category Archives: Matrix

## Check given matrix is magic square or not

Given a matrix, check whether it’s Magic Square or not. A Magic Square is a n x n matrix of distinct element from 1 to… Read More »

## N-th term of George Cantor set of rational numbers

George cantor named mathematician gave a proof that set of rational numbers is enumerable. We don’t have to proof it over here rather we have… Read More »

## Count rows/columns with sum equals to diagonal sum

Given an n x n square matrix, count all rows and columns whose sum is equal to the sum of any principal diagonal or secondary… Read More »

## Squares of Matrix Diagonal Elements

You have given an integer matrix with odd dimensions. Find the square of the diagonals elements on both sides. Examples: Input : 1 2 3… Read More »

## Program to find all types of Matrix

Given the dimension of the matrix R(rows) * C(column) the task is to find which type of matrix is representing by the given dimension. Examples:… Read More »

## Sorting rows of matrix in ascending order followed by columns in descending order

Given a matrix, sort the rows of matrix in ascending order followed by sorting the columns in descending order. Examples : Input : a =… Read More »

## Program to check if matrix is singular or not

A matrix is said to be singular if the determinant of the matrix is 0 otherwise it is non-singular . Examples: Input : 0 0… Read More »

## Check whether a given matrix is orthogonal or not

We are given a matrix, we need to check whether it is an orthogonal matrix or not. An orthogonal matrix is a square matrix and… Read More »

## Sum of middle row and column in Matrix

Given a integer matrix of odd dimensions (3 * 3, 5 * 5). then the task is to find the sum of the middle row… Read More »

## Row-wise vs column-wise traversal of matrix

Two common ways of traversing a matrix are row-major-order and column-major-order. Row Major Order : When matrix is accessed row by row. Column Major Order… Read More »

## Rotate the matrix right by K times

Given a matrix of size N*M, and a number K. We have to rotate the matrix K times to the right side. Examples: Input :… Read More »

## Program to print numbers in digital form

Given a number n then print number in Digital form. Examples : Input : 5 Output : – – | – – | – -… Read More »

## Swap major and minor diagonals of a square matrix

Given a square matrix, swap the element of major and minor diagonals. Major Diagonal Elements of a Matrix : The Major Diagonal Elements are the… Read More »

## N Queen in O(n) space

Given n, of a n x n chessboard, find the proper placement of queens on chessboard. Previous Approach : N Queen Recommended: Please try your… Read More »

## Print a matrix in Reverse Wave Form

Given a matrix, print it in Reverse Wave Form. Examples : Input : 1 2 3 4 5 6 7 8 9 10 11 12… Read More »