{}DSA Atlas

Visualizers

Algorithms click when you can watch them work. Each visualizer precomputes every step so you can play, pause, and step backwards and forwards. Edit the inputs to try your own cases.

Sorting algorithms

Read the topic →

Partition around a pivot (last element, Lomuto), then sort both sides. O(n log n) average.

1/271
Start
comparingmoving / swappingin final position

Two pointers (pair sum in a sorted array)

Read the topic →

Every move rules out a whole row or column of candidate pairs, so the search takes O(n) instead of O(n²).

1/6
1L
3
4
6
8
11
14
17
20R
1 + 20 = 21 < 25: a[L] is too small for every remaining partner → L++

Sliding window (longest substring without repeats)

Read the topic →

The right edge always moves forward; the left edge moves forward only to restore validity. Both move at most n times → O(n).

1/30
aL/R
b
c
a
b
c
b
b
x
y
z
Expand: add 'a' (count 1)
best = 0

Monotonic stack (next greater element)

Read the topic →

Indices wait on the stack until a bigger value arrives and answers them. Each index is pushed and popped once → O(n).

1/23
array
2i
1
5
3
4
1
6
2
next greater
·
·
·
·
·
·
·
·
stack (bottom → top), showing values
Look at a[0] = 2

Graph search on a grid

Read the topic →

Explores in rings of equal distance. Finds the shortest path by number of steps, but ignores terrain cost. Click or drag on the grid to draw walls or mud (cost 5); every edit re-runs the search.

1/471
Visited 0 cells
startgoalwallmud (cost 5)visitedpath

Tree traversals

Read the topic →

In-order visits left, root, right. On a BST this yields the values in sorted order. Values are inserted into a binary search tree in the order you type them.

1/11
50302040354570606580
Output: []

DP table: longest common subsequence

Read the topic →

dp[i][j] = LCS length of the first i letters of the row string and the first j letters of the column string. Watch each cell pull from its neighbours, then backtrack to recover the subsequence.

1/52
∅BDCABA
∅0000000
A0000111
B0111122
C0112222
B0112233
D0122233
A0122334
B0122344
Row 0 and column 0 are 0: an empty prefix has no common subsequence.
cell being computedcells it depends onbacktracking path