I stayed in touch with Princeton high school’s computer science teacher after both my children graduated. On one of my visits she mentioned, that many students can not translate algorithm animations into code, especially where recursion is involved.

So I developed animations for mergesort, permutations, and recursive factorial that show code and data next to each other. Now my teacher friend uses these in her classes.

First I implemented the algorithms in Python, annotated the code with print statements that traced their actions in JSON format. I designed JavaScript classes for showing the data, stacked code snippets and an action class to match the ones printed by the Python routines. Look behind the scene on GitHub