Algorithms, step by step
Watch each algorithm run on a list, one step at a time, with its pseudocode and its Python side by side, then test yourself with "What happens next?". Made for a first course in programming and algorithms.
Bubble sort
LiveWatch neighbours swap until the list is sorted, with pseudocode, Python and a quiz.Selection sort
LiveWatch each pass pick the smallest value and swap it to the front, with pseudocode, Python and a quiz.Insertion sort
LiveWatch each value slide left into the part already in order, with pseudocode, Python and a quiz.Binary search
LiveWatch the range halve until the value turns up, with pseudocode, Python and a quiz.Merge sort
LiveWatch the list split into halves and merge back sorted, with pseudocode, Python and a quiz.Quicksort
LiveWatch each pivot split the list and land in its final place, with pseudocode, Python and a quiz.
By kind
Sorting
Watch neighbours swap until the list is sorted, with pseudocode, Python and a quiz.
Worst case O(n²)StableIn place
Watch each pass pick the smallest value and swap it to the front, with pseudocode, Python and a quiz.
Worst case O(n²)In place
Watch each value slide left into the part already in order, with pseudocode, Python and a quiz.
Worst case O(n²)StableIn place
Watch the list split into halves and merge back sorted, with pseudocode, Python and a quiz.
Worst case O(n log n)Stable
Watch each pivot split the list and land in its final place, with pseudocode, Python and a quiz.
Worst case O(n²)In place
Searching
Watch the range halve until the value turns up, with pseudocode, Python and a quiz.
Worst case O(log n)
In class
Every page works on a projector and on a phone. Pick a list, play it slowly, and stop on a step to ask the class what comes next; the quiz does the same on its own, with a new random list each round.
The Python on each page is the code the simulation follows, line by line, and a test runs it on every list the page can draw.
Questions
- What is on each algorithm page?
- A simulation you can play, pause and step through on a list of your own; the algorithm in pseudocode and in Python with the running line lit; how it works and its complexity; and "What happens next?", a five-question quiz on a random list.
- Is it free?
- Yes. Every page runs in your browser, with no account, and the lists you type never leave it.
- Which algorithm should I start with?
- Bubble sort, then selection sort and insertion sort: all three grow a sorted part one value at a time, and seeing them side by side shows why insertion sort usually makes the fewest comparisons. Then binary search, and last merge sort and quicksort, which split the list and sort each part the same way.