Skip to content
DSA Visualizerpreview

Watch an algorithm think

The algorithms and data structures a coding interview expects, one action at a time. Each step shows the line of code it runs, the variables it changed and what it has cost against its bound, and you can bring your own input.

Find an algorithmStart with Big-O

Quick sort

Start with the array 38, 12, 71, 25, 90, 7, 56, 43, 19, 64, 30, 82.

Array of 12 values: 38, 12, 71, 25, 90, 7, 56, 43, 19, 64, 30, 82.
step 1 of 56Step through it yourself

The learning path

58 pages in 17 topics, in the order they build on each other.

Complexity

How the work grows as the input grows: the language every other page uses.

Arrays

Contiguous slots: instant access by index, and a plan for when they fill up.

Hashing

Turn a key into a slot number; the interesting part is what happens when two keys collide.

Stacks and queues

Last in, first out against first in, first out: the two orders much else is built on.

Linked lists

Values joined by pointers. Watch the arrows, not the boxes.

Two pointers

Walk inwards from both ends, moving whichever pointer can only help.

Sliding window

Keep a running answer for a range, adding what enters and removing what leaves.

Sorting

Put values in order, and count what it costs: comparisons, swaps and writes.

Searching

Find a value without looking at everything: rule out half the array at a time.

Trees

Hierarchies you can search in O(log n) when they stay balanced, and O(n) when they do not.

Heaps

A tree kept in an array, where every parent beats its children: the minimum is always on top.

Tries

Words stored letter by letter, so words with the same prefix share a path.

Graphs

Nodes and edges: search them breadth-first or depth-first, order them, find shortest paths, group them.

Backtracking

Try a choice, explore everything it leads to, then undo it and try the next: a tree of recursive calls.

Dynamic programming

Solve each smaller problem once, keep the answer, and build bigger answers out of it.

Greedy

Make the choice that looks best right now and never revisit it; it works when you can prove it does.

Intervals

Ranges on a timeline: sort them by start or end, then sweep once.