algo·visual

About

Algorithms make more sense when you can watch them work.

Most people meet data structures and algorithms as pseudocode next to a diagram frozen at one moment. What happens between one line and the next is left to your imagination.

algo·visual shows that part. Every comparison, swap, pointer change and table cell is a step you can pause on, rewind or replay, with the real code highlighted next to it. I made it for students, whether you are seeing this for the first time or revising for an exam or an interview, and for anyone who learns by poking at things.

How to use it

Four ways to play with it

Space←→

Play, pause, step

Space plays and pauses, and the arrow keys move one step. Each step explains itself in a sentence.

HomeEnd

Scrub backwards

Drag the timeline anywhere. Every step is saved as a snapshot, so going back is as easy as going forward.

R

Change the input

Randomise it, type your own values, build a list of operations or draw walls on a grid.

Compare two

Run two algorithms on the same input with one shared clock and see which one finishes first.

Press ? anywhere to see every shortcut, or ⌘K to jump to an algorithm.

Try these

Six experiments worth five minutes each

How it's built

Every algorithm runs once, then you replay it

  1. 1

    Algorithm

    Each algorithm is a plain TypeScript generator. It runs once and saves a snapshot whenever something worth seeing happens: the data, what is highlighted, the current line of code, the live variables and a one-line explanation.

  2. 2

    Timeline

    The snapshots go into an array. Play, pause, rewind, jump to the end and compare mode only change which snapshot is on screen, so nothing ever runs twice.

  3. 3

    Renderer

    A renderer draws one snapshot. Every element keeps a stable id, so going from one snapshot to the next turns into a spring animation without any per-algorithm animation code.

The algorithms never touch the interface, so each one can be tested on its own. Every highlighted line has to exist in the code you see, and every result is checked against a separate reference implementation on dozens of random inputs. Pages are generated ahead of time, so the deployed site is plain static files. All of it is on GitHub.

algorithms
36
renderers
11
categories
5
static pages
100%

Made by

Imran Sefat

Imran Sefat

@ImranSefat

I built algo·visual because algorithms are much easier to follow when you can watch each step happen. If it helped something click for you, or there is an algorithm you would like to see here, send me a message.

Open source

Ask for what you want to see

algo·visual is free and open source under the MIT license. You don't need to write code to help: ideas from people learning this material are the most useful kind of contribution. Each link below opens a short form on GitHub.

ImranSefat/algo-visual

MIT licensed. Pull requests are welcome.

Credits

Built on open source

Everything below is open source or free to use, and this site would not exist without the people who maintain it. Thank you.

Framework and language

  • Next.js

    Routing, static generation, OG images

    MIT
  • React

    UI and the React Compiler

    MIT
  • TypeScript

    Every algorithm and component

    Apache-2.0

Interface

Animation, state and layout

Code, fonts and icons

Testing and randomness

  • Vitest

    Correctness tests for every algorithm

    MIT
  • Lighthouse

    Performance and accessibility checks

    Apache-2.0
  • mulberry32

    Seeded random inputs, by Tommy Ettinger

    Public domain

Inspiration

The GitHub and LinkedIn marks are trademarks of their owners and only link to my profiles. Each license is the one the project publishes for the version this site uses.

Search algorithms

Jump to any algorithm or page