Playground.
Don't just read about it — run it.
Every lab here is a real, hand-built model of the idea: the algorithm actually runs, one visible step at a time. Change the input, press play, step back, try to break it.
- 10 interactive labs
- Step forward & back
- Runs in your browser
Algorithms
Watch every compare, swap and visit.
- Sort these numbersBubble SortHow bubble sort puts a list in order by repeatedly comparing neighbouring values and swapping the pairs that are out of order.Open lab
- Find a number in half the timeBinary SearchHow binary search finds a value in a sorted list by checking the middle and throwing away the half that cannot contain it.Open lab
- Explore a graph level by levelBreadth-First SearchHow breadth-first search visits a graph in rings of increasing distance from a start node, using a queue.Open lab
Data structures
Add, remove and follow the pointers.
- Build a linked listLinked ListHow a singly linked list stores values in separate nodes joined by next pointers, and how inserting or deleting only rewires pointers.Open lab
- Push, pop, enqueue, dequeueStack and QueueThe difference between a stack (last in, first out) and a queue (first in, first out).Open lab
Machine learning & neural nets
Change a number, watch the model react.
- Classify a point with KNNk-Nearest NeighboursHow a k-nearest-neighbours classifier labels a new point: measure its distance to every known point, take the K closest, and let them vote.Open lab
- Move down the loss curveGradient DescentHow gradient descent minimises a loss by repeatedly stepping against the gradient, and how the learning rate controls whether it converges, oscillates or diverges.Open lab
- Change a weight, watch the outputNeural Network Forward PassHow a neural network turns inputs into an output: each neuron computes a weighted sum plus bias, applies an activation function, and passes the result on.Open lab
- Move the kernel across the imageConvolutionHow a convolution layer slides a small kernel over an image, multiplying and summing at each position to build a feature map.Open lab
How code runs
Step inside a running program.
Try one right now
No sign-up. Press ▶ Play, or step through with the arrow keys.
Try it: Bubble Sort
How bubble sort puts a list in order by repeatedly comparing neighbouring values and swapping the pairs that are out of order.
How it works
- Walk the list from left to right, comparing each value with its right-hand neighbour.
- If the left value is larger, swap the two.
- After one pass the largest remaining value has 'bubbled' to the end, where it stays.
- Repeat on the unsorted part. A pass with no swaps means the list is sorted, so stop early.
Default run (21 steps): Unsorted array: [8, 3, 5, 1, 9]. Bubble sort compares neighbours and swaps them when they are out of order. … Sorted: [1, 3, 5, 8, 9] after 10 comparisons and 5 swaps.
Simplified: Educational version of bubble sort on up to 12 numbers. Python's built-in sort() uses a different, faster algorithm (Timsort).
Loading the simulation…