Algorithms & data structures

Algorithms you can watch

Every part is worked out in Python and drawn step by step in the browser, with the real numbers: how many comparisons, how many writes, how much work.

Built by Jarl Lindquist to understand these properly, not just to pass an exam: jarllindquist.com

What you can do here

Follow every step

Pause, step forward and watch what the algorithm looks at: which two values it compares, what it moves, where the pivot is, which cell a search visits next.

See the real numbers

Not just O(n log n) in a table: the exact comparisons and writes of your run, and a chart of how the work grows as the list gets longer.

Compare

Let two sorts race on the same numbers, run four pathfinders on the same maze, or put the same keys in two kinds of hash table.

Use your own input

Type your own numbers, words and text, draw walls and cells. Nearly sorted lists, two words that differ by one letter, an emoji: try the cases that make algorithms struggle.

What it covers

See all the parts →

How it is built

  1. Python works it out. Flask runs the algorithm and logs every step, and counts the comparisons and writes on the side.
  2. The browser draws it. Plain JavaScript turns the steps into bars, tables, trees and grids with SVG and canvas. No frameworks, no chart libraries.
  3. Nothing is kept on the server. Your stack, tree and hash table live in your browser and are sent with each request, so every visitor has their own.
  4. Tested and shipped automatically. Over 200 tests check the algorithms against the textbook and against slow but obvious versions; GitHub Actions builds a Docker image and deploys it behind Traefik.

Four languages · light and dark mode · works with the keyboard · stands still for those who prefer reduced motion · readable without JavaScript.