# Category Archives: Matrix

## Program to check diagonal matrix and scalar matrix

Diagonal matrix: A square matrix is said to be diagonal matrix if the elements of matrix except main diagonal are zero. A square null matrix… Read More »

## A square matrix as sum of symmetric and skew-symmetric matrices

Let A be a square matrix with all real number entries. Find two symmetric matrix P and skew symmetric matrix Q such that P +… Read More »

## Count frequency of k in a matrix of size n where matrix(i, j) = i+j

Given a matrix of size n*n. Count the frequency of given element k in that matrix. Here base index is 1. Examples: Input : n… Read More »

## Given 1’s, 2’s, 3’s ……k’s print them in zig zag way.

Given number of rows and columns. And given number of 1’s, 2’s, 3’s ……k’s which needs to be printed. Print them in a zig-zag way.… Read More »

## Banker’s Algorithm in Operating System

Prerequisite – Resource Allocation Graph (RAG), Banker’s Algorithm, Program for Banker’s Algorithm Banker’s Algorithm is a resource allocation and deadlock avoidance algorithm. This algorithm test… Read More »

## Kronecker Product of two matrices

Given a matrix A and a matrix B, their Kronecker product C = A tensor B, also called their matrix direct product, is an matrix.… Read More »

## Sparse Matrix Representations | Set 3 ( CSR )

If most of the elements in the matrix are zero then the matrix is called a sparse matrix. It is wasteful to store the zero… Read More »

## Largest rectangular sub-matrix having sum divisible by k

Given a n x n matrix of integers. The problem is to find the largest area rectangular sub-matrix having sum divisible by the given value… Read More »

## Python Counter| Find duplicate rows in a binary matrix

Given a binary matrix whose elements are only 0 and 1, we need to print the rows which are duplicate of rows which are already… Read More »

## Python List Equality | Program to check if two given matrices are identical

We are given two square matrices of same order. Check if two given matrices are identical. Examples: Input : A = [ [1, 1, 1,… Read More »

## Maximum number of customers that can be satisfied with given quantity

A new variety of rice has been brought in supermarket and being available for the first time, the quantity of this rice is limited. Each… Read More »

## Python heapq to find K’th smallest element in a 2D array

Given an n x n matrix and integer k. Find the k’th smallest element in the given 2D array. Examples: Input : mat = [[10,… Read More »

## Python | Print unique rows in a given boolean matrix using Set with tuples

Given a binary matrix, print all unique rows of the given matrix. Order of row printing doesn’t matter. Examples: Input: mat = [[0, 1, 0,… Read More »

## Find the Surface area of a 3D figure

Given a N*M matrix A[][] representing a 3D figure. The height of the building at is . Find the surface area of the figure. Examples… Read More »

## Python map function to find row with maximum number of 1’s

Given a boolean 2D array, where each row is sorted. Find the row with the maximum number of 1s. Examples: Example Input: matrix = [[0,… Read More »