Algorithm videos that show the code really running

What makes an algorithm animation teach: every step exact, the code lit beside the picture, a small input traced and a viewer asked to predict. The evidence.

By the Chasca team 5 min read

This video was made with the Algorithm visuals skill. Read the transcript

An algorithm animation teaches when every step on screen is exact, when the code is shown beside the picture as it runs, and when the viewer is asked to think about the next step instead of only watching. Research on algorithm visualisation since the 1990s points the same way: the picture matters less than how closely the viewer follows it, and a small, complete example beats a large, skipped one.

Do algorithm animations help students learn?

They can, with a condition. Christopher Hundhausen, Sarah Douglas and John Stasko’s meta-study of algorithm visualisation effectiveness reviewed 24 experimental studies and found that what learners did with a visualisation predicted its success better than how it looked: studies grounded in learners actively working through the algorithm had the best record.

A working group led by Thomas Naps turned this into an engagement taxonomy: not viewing, viewing, responding (answering questions about what will happen), changing (trying other inputs), constructing and presenting. When Scott Grissom, Myles McNally and Thomas Naps compared these levels on simple sorting algorithms, learning gains grew as students moved from only viewing to responding and changing.

A video is watched, so it starts at viewing. It can still ask: a good explainer stops before a step and asks which number moves next, then shows the answer. And a video made from the viewer’s own input, or the input from their homework, moves them towards changing.

Why must every step be exact?

Because an algorithm is its steps. A swap in the wrong place, or a pointer one cell off, teaches a different algorithm, and a student who learns from it carries the mistake into their code. Hand-made animations are drawn step by step, so even the best ones skip parts (“we’ll let the recursion handle the rest”) and show only the run their author had time to draw.

When Clifford Shaffer and colleagues surveyed the field in Algorithm Visualization: The State of the Field, they found hundreds of visualisations, unevenly spread across topics and of mixed quality. A teacher looking for one that is correct, complete and in their students’ language often finds none.

The fix is to run the algorithm. A real run can’t skip a step or invent one: the picture, the highlighted line and the variables all come from what the code actually did.

Why show the code beside the picture?

Because the code is what students write, debug and get asked about in interviews and exams. Program visualisation, showing a program’s state as it runs line by line, is a long-standing way of teaching it: Juha Sorva, Ville Karavirta and Lauri Malmi’s review of program visualisation systems covers dozens of them, and Philip Guo’s Online Python Tutor put the idea in front of a very large audience.

An algorithm video joins the two: the data structure as a picture, the code as it runs, and the variables between them. When line 11 lights up as the numbers 6 and 5 are compared, the student sees what if a[j] <= pivot does instead of reading it.

What does a good algorithm explainer need?

We studied 16 of the most watched algorithm explainers on YouTube, from sorting and binary search to Dijkstra and dynamic programming. The best of them share a grammar:

  • A question, then one rule. They open on a question or an everyday picture (towns and roads, a shelf of books), then give the one idea to hold while it runs: “everything left of i is at most the pivot”.
  • One small input, traced. The median video spends about half its time running one example, typically 6 to 11 values or 7 to 13 graph nodes.
  • The helper beside the picture. A queue or a stack drawn next to the graph, a memo row next to the recursion.
  • A few colours, said once. The current item in one colour, finished items in another, pointers as short labelled arrows.
  • The key step slowed down. The first steps one by one, then faster, then slow again where it matters.
  • A check and a limit. The result checked against the rule, and one honest limit named (a worst case, negative weights).
  • Big O in a line, with numbers. Few of them count the run’s own comparisons, which makes growth something you see.

What none of the 16 did: keep the code and the picture moving together for the whole run, show a panel of the variables, or narrate in a language other than English.

How do you make one with Chasca?

Chasca’s Algorithm visuals skill makes the whole video from one sentence:

  1. Name the algorithm. Open Create, pick the skill, and type what to explain, like “Dijkstra’s shortest paths from node 0, in Java” or “binary search for 23 in 2, 5, 8, 12, 16, 23, 38”. Give your own data if you like; it is kept small enough to follow on screen.
  2. Choose the code language. Python, Java, C++ or JavaScript, in the skill’s Code setting or in your request. Choose a dark or a light look, the narrator and the video’s language.
  3. Get the video. The algorithm is run on your data, and the narration is written against that run: a question first, the input and the rule, the run traced with the code lit line by line and the variables watched, the key step slowed down, the result checked, then a chart of how the work grows with this run’s own count on it.

The library covers sorting, searching, two pointers and sliding windows, strings, stacks and queues, hash tables, linked lists, trees, heaps, graphs, recursion and dynamic programming. To compare it with Manim, Motion Canvas and screen recorders, see the best algorithm visualization video tools.

Sources

Video transcript What the narrator says in the 1:05 explainer above.

How can you sort these numbers without repeatedly finding the smallest?

These 7 numbers need sorting. Through i, values stay at most the pivot. Orange marks executing code; green means done.

Line 8 picks pivot 5. Line 11 leaves 8 right because it exceeds 5.

3 belongs left. Which number will it swap with?

3 swaps with 8; 1 and 2 also move left because neither exceeds 5.

5 lands between the sides, permanently placed.

Recursion partitions the left around 2; single numbers need no sorting.

8 separates 6 and 9; the pivot rule now holds everywhere. Worst-case work is quadratic.

The chart marks 10 comparisons for 7 numbers; average work grows as n log n.

Partition, then sort each side: that's how you order the numbers.

Questions people ask

They can, and what students do while watching matters most. A meta-study of 24 experiments found that how learners engage with an algorithm visualisation predicts its success better than what it shows, and a later study found learning gains grew as students moved from only viewing to answering questions about the animation.

Because the code is what students write and what interviews and exams ask about. Seeing the line that runs next to the change it makes ties the two together; program visualisation tools such as Python Tutor are built on that idea.

Small enough to follow every step: the most watched algorithm explainers trace arrays of 6 to 11 values (8 is typical) and graphs of 7 to 13 nodes, and spend about half the video on that one run.

Chasca's Algorithm visuals skill makes one from a sentence, like "quick sort on 8, 3, 6, 1, 9, 2, 5 in Java": it runs the algorithm on that data and narrates it step by step, the code lit line by line beside the picture, in Python, Java, C++ or JavaScript.

Yes. The Algorithm visuals skill narrates in any of Chasca's 79 languages; the code and its variable names stay as the programming language writes them.

Keep reading

Your next explainer takes under a minute.

Your first 2 videos are free, up to 1 minute each, watermarked. No card required. Full product, every voice and style included.