Linear Data Structures

Concept shape

Core
0
1
2
3
4
5
Definition

A matrix is a two-dimensional array, commonly used for grids, maps, tables, and DP states.

Step 1 / 5
Concept shape
Current lesson

Matrices and Grids Lab

Linear Data Structures Core

Matrices and Grids

Welcome to the Matrices and Grids concept lab. A matrix is a two-dimensional array, commonly used for grids, maps, tables, and DP states. The must know points are: Use row and column indexes. Neighbors often mean up, down, left, and right. Bounds checks matter on every move. The common operations are: read cell O(1), scan all cells O(rows * cols), visit neighbors O(1). The complexity shape is Full scan O(R*C). Watch out for these pitfalls: Swapping row and column. Missing boundary checks. Revisiting cells without a seen marker. Related algorithms include BFS, DFS, Dynamic Programming.

Concept details

A matrix is a two-dimensional array, commonly used for grids, maps, tables, and DP states.

Must know

  • Use row and column indexes.
  • Neighbors often mean up, down, left, and right.
  • Bounds checks matter on every move.

Complexity

Full scan O(R*C)

Open deeper visual structure lesson
1.0x