Matrix Data Structure
Learn more about Matrix in DSA Self Paced Course
Practice Problems on Matrix
Top Quizzes on Matrix
What is Matrix Data Structure?
A matrix represents a collection of numbers arranged in an order of rows and columns. It is necessary to enclose the elements of a matrix in parentheses or brackets.
For example:
A matrix with 9 elements is shown below.
This Matrix [M] has 3 rows and 3 columns. Each element of matrix [M] can be referred to by its row and column number. For example, a23 = 6.
Topics:
- Introduction to Matrix or Grid – Data Structure and Algorithms Tutorial
- Row-wise vs column-wise traversal of matrix
- Applications of Matrices and Determinants
- Traverse a given Matrix using Recursion
- Rotate Matrix Elements
- Sort the given matrix
- Search element in a sorted matrix
- Program to find transpose of a matrix
- Adjoint and Inverse of a Matrix
- Determinant of a Matrix
- Easy:
- Print matrix in zag-zag fashion
- Program for scalar multiplication of a matrix
- Print a given matrix in spiral form
- Find distinct elements common to all rows of a matrix
- Find unique elements in a matrix
- Find maximum element of each row in a matrix
- Shift matrix elements row-wise by k
- Swap major and minor diagonals of a square matrix
- Squares of Matrix Diagonal Elements
- Sum of middle row and column in Matrix
- Program to check idempotent matrix
- Program to check diagonal matrix and scalar matrix
- Program for Identity Matrix
- Mirror of matrix across diagonal
- Program for addition of two matrices
- Program for subtraction of matrices
- Medium:
- Program for Conway’s Game Of Life
- Program to multiply two matrices
- Rotate a matrix by 90 degree without using any extra space
- Check if all rows of a matrix are circular rotations of each other
- Given a matrix of ‘O’ and ‘X’, find the largest subsquare surrounded by ‘X’
- Maximum size square sub-matrix with all 1s
- Count zeros in a row wise and column wise sorted matrix
- Queries in a Matrix
- Find pairs with given sum such that elements of pair are in different rows
- Find all permuted rows of a given row in a matrix
- Find number of transformation to make two Matrix Equal
- Inplace (Fixed space) M x N size matrix transpose
- Minimum flip required to make Binary Matrix symmetric
- Magic Square
- Hard:
- Find the number of islands
- A Boolean Matrix Question
- Matrix Chain Multiplication
- Maximum size rectangle binary sub-matrix with all 1s
- Construct Ancestor Matrix from a Given Binary Tree
- Print K’th element in spiral form of matrix
- Find size of the largest ‘+’ formed by all ones in a binary matrix
- Shortest path in a Binary Maze
- Print maximum sum square sub-matrix of given size
- Validity of a given Tic-Tac-Toe board configuration
- Minimum Initial Points to Reach Destination
- Strassen’s Matrix Multiplication
- Maximum sum rectangle in a 2D matrix
- Program for Sudoku Generator
Recomended:
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.