# Category Archives: Matrix

## Move matrix elements in given direction and add elements with same value

Given a matrix m[ ][ ] of size n x n consisting of integers and given a character ‘x’ indicating the direction. Value of ‘x’… Read More »

## Program for scalar multiplication of a matrix

Given a matrix and a scalar element k, our task is to find out the scalar product of that matrix. Examples: Input : mat[][] =… Read More »

## Find unique elements in a matrix

Given a matrix mat[][] having n rows and m columns. We need to find unique elements in matrix i.e, those elements which are not repeated… Read More »

## Center element of matrix equals sums of half diagonals

Given a matrix of odd order i.e(5*5). Task is to check if the center element of the matrix is equal to the individual sum of… Read More »

## Shift matrix elements row-wise by k

Given a square matrix mat[][] and a number k. The task is to shift first k elements of each row in the right of the… Read More »

## Rat in a Maze with multiple steps or jump allowed

This is the variation of Rat in Maze A Maze is given as N*N binary matrix of blocks where source block is the upper left… Read More »

## Different Operations on Matrices

For introduction on matrices, you can refer the following article: Matrix Introduction In this article, we will discuss various operations on matrices and their properties:… Read More »

## Reverse Diagonal elements of matrix

Given a square matrix of order n*n, we have to reverse the elements of both diagonals. Examples: Input : {1, 2, 3, 4, 5, 6,… Read More »

## Variance and standard-deviation of a matrix

Prerequisite – Mean, Variance and Standard Deviation, Variance and Standard Deviation of an array Given a matrix of size n*n. We have to calculate variance… Read More »

## Maximum and Minimum Values of an Algebraic Expression

Given an algebraic expression of the form (x1 + x2 + x3 + . . . + xn) * (y1 + y2 + . .… Read More »

## Print a given matrix in counter-clock wise spiral form

Given a 2D array, print it in counter-clock wise spiral form. See the following examples. Examples : Input: 1 2 3 4 5 6 7… Read More »

## Freivald’s Algorithm to check if a matrix is product of two

Given three matrices A, B and C, find if C is a product of A and B. Examples: Input : A = 1 1 1… Read More »

## 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 »