Explorations
Algorithms
An algorithm is a sequence of steps for solving a problem. Change the input, follow the data, and watch each decision unfold.
Searching and pathfinding
Explore connections and discover routes through a weighted graph.
Open the pathfinding playgroundBreadth-first search
Explore one layer at a time. Find a path with the fewest edges.
Prerequisites: Nodes, edges, and a first-in-first-out queueDijkstraDijkstra’s algorithm
Explore the cheapest known route first. Minimize total weight.
Prerequisites: Nodes, weighted edges, and choosing a minimumA*A* search
Combine cost so far with an estimate of the journey remaining.
Prerequisites: Dijkstra’s algorithm and an estimate of remaining costDFSDepth-first search
Follow one branch deeply, then backtrack when it runs out.
Prerequisites: Nodes, edges, and a last-in-first-out stackTwo-way BFSBidirectional breadth-first search
Search outward from both endpoints and join where the searches meet.
Prerequisites: Breadth-first search and reconstructing a predecessor chainGreedyGreedy best-first search
Head toward the most promising-looking node, ignoring cost already paid.
Prerequisites: A frontier and an estimate of remaining costSorting
Put values in order and inspect every comparison, swap, and write.
Open the sorting playgroundBubble sort
Compare neighbors and let large values travel to the right.
Prerequisites: Arrays, comparisons, and swapping two itemsSelectionSelection sort
Find the smallest remaining item and place it in the next slot.
Prerequisites: Arrays, comparisons, and tracking a minimumInsertionInsertion sort
Grow a sorted prefix by moving each new item into place.
Prerequisites: Arrays, comparisons, and a sorted prefixMergeMerge sort
Sort two halves, then weave their values into one ordered sequence.
Prerequisites: Arrays, recursion, and merging two sorted sequencesQuickQuicksort
Partition around a pivot, then sort the ranges on either side.
Prerequisites: Arrays, recursion, and partitioning around a pivotSearching arrays
Compare sequential inspection with halving a sorted interval.
Open the array search playgroundString matching
Locate every occurrence of a pattern and see how prefix reuse avoids repeated work.
Open the string matching playgroundNaïve string matching
Try the pattern at every possible starting position.
Prerequisites: Strings, character positions, and comparing charactersKMPKnuth–Morris–Pratt search
Reuse matched prefixes instead of restarting after a mismatch.
Prerequisites: String matching, prefixes, suffixes, and array indicesNumber theory
Follow remainders, prime elimination, integer coefficients, and repeated squaring.
Open the number theory playgroundEuclidean algorithm
Find a greatest common divisor through successive remainders.
Prerequisites: Whole numbers, divisibility, and remaindersExtended EuclidExtended Euclidean algorithm
Find a GCD and coefficients explaining how the inputs produce it.
Prerequisites: Euclid’s algorithm and integer linear combinationsSieveSieve of Eratosthenes
Cross out multiples and reveal every prime up to a limit.
Prerequisites: Divisibility, multiples, and prime numbersPowerBinary exponentiation
Build large powers by repeated squaring and halving.
Prerequisites: Integer exponents, multiplication, and parityDynamic programming
Build answers from stored subproblems, then recover the choices behind an optimum.
Open the dynamic programming playgroundRelease journal
· Ten algorithms, four new families
Array search, string matching, number theory, and dynamic programming join the collection. Inspect search intervals, KMP prefix reuse, Euclidean identities, prime elimination, exact powers, Fibonacci dependencies, and knapsack choices.
· Five ways to sort
A new sorting family adds bubble sort, selection sort, insertion sort, merge sort, and quicksort. Compare the same input with reversible playback, item identities, operation counts, temporary merge storage, and highlighted pseudocode.
· Three new search strategies
Depth-first search reveals its call stack and backtracking. Bidirectional breadth-first search shows two queues and two predecessor trees. Greedy best-first search demonstrates what happens when remaining distance guides a search without considering the cost already paid.
· First expedition
Three graph-search algorithms share an editable map, reversible playback, live distances and predecessors, and highlighted pseudocode. Compare equal costs, weighted routes, and a destination that cannot be reached.