🤖

Algorithms & AI

Swarm intelligence and nature-inspired optimisation algorithms. Complex behaviour without central control — only local rules.

The Algorithms & AI category covers the core ideas of computer science made visual: pathfinding, sorting, search, graph theory, dynamic programming, data structures and machine-learning fundamentals. Each interactive Algorithms & AI model runs directly in your browser, so you can step through A* expanding a grid, watch a genetic algorithm evolve a solution, or see how ant colony optimisation finds the shortest route. You will learn how heuristics, recursion, complexity and emergence actually behave — building intuition that static diagrams and textbooks struggle to convey. These topics matter because the same techniques power navigation, logistics, compression, databases, game AI and modern machine learning, making this a practical way to learn Algorithms & AI online.

10+ simulations Three.js · Canvas 2D Swarm · ACO · Reynolds

Category Simulations

Open a simulation — it runs right in your browser

Emergent behaviour — system-level properties that arise from inter-agent interactions that are not programmed into any single agent. The ant trail, the bird flock — no individual “knows” about the overall result.

🌲
New ★★★★ Advanced
Red-Black Tree
Insert and delete keys in a red-black tree and watch recolouring and rotations keep it balanced.
red-black tree balanced BST rotations
🗃️
New ★★★★ Advanced
B-Tree
Build a B-tree of order m by inserting keys: nodes fill, split at the median and push a key upward, keeping every leaf at the same depth.
B-tree database index node splitting
⏭️
New ★★★ Advanced
Skip List
A skip list stacks express lanes over a sorted linked list: each node is promoted with probability ½, giving expected O(log n) search by skipping a…
skip list probabilistic express lanes
📝
New ★★★ Advanced
Edit Distance
Fill the Levenshtein dynamic-programming table cell by cell, then backtrack the cheapest path of insertions, deletions and substitutions that turns…
edit distance Levenshtein dynamic programming
🧬
New ★★★ Advanced
Longest Common Subsequence
Compute the longest common subsequence of two strings with a DP grid, then trace the diagonal matches back — the algorithm behind diff tools and DN…
LCS dynamic programming diff
🔎
New ★★★ Advanced
KMP String Matching
Knuth-Morris-Pratt searches text in O(n+m): a prefix failure function lets the pattern slide forward without re-checking matched characters.
KMP string matching failure function
🔗
New ★★★ Advanced
Union-Find
Merge elements into disjoint sets and find their roots in near-constant time.
union-find disjoint set path compression
🌡️
New ★★★ Advanced
Simulated Annealing
Solve a travelling-salesman tour with simulated annealing: accept worse moves with probability e^(−ΔE/T) while temperature cools, escaping local mi…
simulated annealing optimization Metropolis
🐝
New ★★★ Advanced
Particle Swarm Optimization
A swarm of particles searches a 2D cost landscape, each pulled toward its personal best and the global best.
PSO swarm intelligence optimization
🗼
★★☆ Moderate
Tower of Hanoi
Optimal recursion solves 1–10 disks in 2ⁿ−1 moves, animated lift-shift-drop. Manual mode rejects illegal moves.
Recursion Algorithms Canvas 2D
🔢
★★☆ Moderate
Gray Code
Reflected binary g = b⊕(b≫1): consecutive values differ by one bit. Hamiltonian path on the n-cube; rotary encoders.
Gray Code Hypercube Canvas 2D
💾
★★★ Advanced New
Hamming Error-Correcting Codes
Visualise how Hamming(7,4) and SECDED(8,4) detect and correct single-bit errors. Toggle message bits, flip any codeword bit, and watch syndrome decoding identify and fix the error.
Error Correction Syndrome Decoding SECDED Canvas 2D
⚙️
★★★ Advanced New
Compiler Pipeline
Watch source code become machine code: lexing to tokens, recursive-descent parsing to an AST, three-address codegen and a constant-folding pass — type any arithmetic expression and step through.
Compiler Parsing AST Canvas 2D
📡
★★★ Advanced
Kalman Filter — State Estimation
Optimally fuse noisy measurements with a motion model. The covariance ellipse grows on predict and shrinks on update; the Kalman estimate beats both raw measurements and model-only — RMSE proves it.
Canvas 2D Kalman Sensor Fusion Tracking
♟️
★★★ Advanced
Minimax & Alpha-Beta — Game Tree
DFS the game tree assuming the opponent plays optimally; α-β pruning skips branches that can't matter. Watch the (α, β) window tighten, cutoffs grey out subtrees, and compare leaves visited.
Canvas 2D Minimax Alpha-Beta Game Tree
🟦
★★★ Advanced
Convex Hull — Graham, Jarvis, Quickhull
Compute the smallest convex polygon around a point set with three classic algorithms, animated step by step with live cross-product turn detection and comparative operation counts.
Canvas 2D Graham Scan Quickhull Geometry
🌌
★★★ Advanced
Barnes–Hut N-body
An N-body gravity simulation in O(n log n) using a quadtree and a θ accuracy criterion. Watch the tree adapt to clusters and force evaluations plummet vs naïve O(n²).
Canvas 2D Quadtree N-Body θ-criterion
〰️
★★★ Advanced
Marching Squares — Contouring
Extract contour lines from a 2D scalar field with the 16-case marching-squares lookup. Drag metaballs, switch to noise or paint, and resolve the famous saddle ambiguity.
Canvas 2D Contour Isoline Metaballs
🌲
★★★ Advanced
Quadtree — Spatial Subdivision
A quadtree recursively subdivides the plane into four children. Watch it adapt to your point swarm and accelerate range, nearest-neighbour and collision queries — far fewer nodes visited than O(n).
Canvas 2D Quadtree Range Query Spatial Index
🎒
★★★ Advanced
0/1 Knapsack — Dynamic Programming
Maximize value without exceeding capacity. Watch DP fill the table cell by cell with the take-vs-skip recurrence, then backtrack to recover the optimal item set — and see why greedy can fail.
Canvas 2D Dynamic Programming Optimization Knapsack
🌳
★★★ Advanced
Huffman Coding — Optimal Compression
Build an optimal prefix-free code by merging the two rarest symbols repeatedly. Watch the tree grow, read off the 0/1 codes, and compare Huffman bits to fixed-length and to the entropy limit.
Canvas 2D Compression Prefix Code Entropy
🗺️
★★★ Advanced
A* Pathfinding
Watch A* find the shortest path on a grid using f = g + h. Paint walls, drag start/goal, switch heuristics, and compare A* vs Dijkstra vs Greedy to see how the heuristic changes nodes expanded.
Canvas 2D Pathfinding A* Dijkstra
💍
★★★ Advanced
Stable Matching — Gale–Shapley
The Gale–Shapley deferred-acceptance algorithm step by step: proposals, tentative engagements and rejections converge to a stable matching with no blocking pairs.
Canvas 2D Gale-Shapley Matching Game Theory
🐦
Popular ★★☆ Moderate
Boids — Swarm Intelligence
Craig Reynolds' 1987 algorithm: three rules — separation, alignment, cohesion. 5,000+ agents in 3D, InstancedMesh, 60fps.
Three.js Reynolds InstancedMesh Swarm AI
🐜
★☆☆ Easy
Ant Colony (ACO)
Ant colony optimisation algorithm (Dorigo, 1992): pheromone trails, stigmergy, self-organised shortest-path finding.
Canvas 2D ACO Stigmergy Pheromones
🗺️
New ★★☆ Moderate
Pathfinding — A*, Dijkstra, BFS
Draw walls, generate mazes and watch A*, Dijkstra, Greedy Best-First and BFS explore the grid step by step. Compare algorithms live.
Canvas 2D A* Dijkstra BFS
📊
New ★★☆ Moderate
Sorting Algorithms — Visual & Audio
12 algorithms animated as bar charts with Web Audio tones. Compare Bubble, Quick, Merge, Heap and more — hear each comparison.
Canvas 2D Web Audio Sorting Algorithms
🏗️
New ★★☆ Moderate
Maze Generator
Four algorithms — DFS Backtracker, Prim’s, Kruskal’s and Wilson’s loop-erased random walk — animated live. Then solve with BFS.
Canvas 2D DFS Kruskal Wilson
🤝
New ★★★ Advanced
Travelling Salesman — TSP
Three algorithms compete on the same cities: Nearest Neighbour greedy, 2-opt local search and Simulated Annealing. Drag cities live.
Canvas 2D 2-opt Simulated Annealing Optimisation
🧬
New ★★☆ Moderate
Genetic Algorithm
Watch a population evolve via selection, crossover and mutation. Two modes: classic Weasel string evolution and 2D Rastrigin optimisation.
Canvas 2D Genetic Evolution Optimisation
🐜
★☆☆ Easy
Langton's Ant
A two-dimensional Turing machine that creates complex emergent highways from just two simple rules. Multiple ants, custom LLRR rulesets and colour modes reveal deep structure in chaos.
Cellular Automaton Emergence Canvas 2D
🌲
New ★★☆ Moderate
Minimum Spanning Tree
Visualise Kruskal's and Prim's MST algorithms on weighted graphs. Watch edges being added in order and see the spanning tree grow.
Graph Theory Kruskal Prim Canvas 2D
🕸️
New ★★☆ Moderate
Force-Directed Graph
Network graph layout using spring forces and charge repulsion. Drag nodes, import JSON graphs and observe community structure emerge.
Graph Physics Layout Canvas 2D
🌳
New ★★☆ Moderate
Decision Tree
Interactive decision tree builder and classifier. See entropy, information gain and Gini impurity guide splits. Visualise classification boundaries.
Machine Learning Entropy Canvas 2D
🧠
New ★★★ Advanced
Self-Organising Map (SOM)
Kohonen SOM learns to represent high-dimensional data on a 2D grid. Watch neurons migrate to cover the input space as training progresses.
Neural Network Kohonen Unsupervised Canvas 2D
New ★★☆ Moderate
N-Queens Problem
Watch backtracking place and retract queens on an N×N board. See every conflict and every solution found in real time. Board size 4–12.
Backtracking Combinatorics Chess Puzzle
🖥️
New ★★☆ Moderate
Turing Machine
Animated scrolling tape with head pointer, transition table and five programs — binary increment, unary addition, palindrome checker, copy, and the 3-state Busy Beaver champion.
Computability Church-Turing Busy Beaver
📊
★☆☆ Beginner New
Sorting Algorithms — Comparison & Visualisation
Interactive visualiser for 6 classic sorting algorithms: Bubble, Quick, Merge, Heap, Insertion and Selection Sort. Watch comparisons, swaps and array state animate in real time. Control speed.
Bubble SortMerge SortQuicksortHeap SortBig-O
🌳
★★☆ Moderate
Binary Search Tree — Insert, Search & Balance
Animated BST operations: insert, search, delete and in-order traversal. Switch to AVL mode to see automatic balancing rotations. Displays Big-O complexity and tree height live.
BST AVL Tree Traversal Big-O
📦
New ★☆☆ Beginner
Data Structures
Interactive visualisations of stacks, queues, linked lists and hash tables — insert, delete and search step by step with animated pointer updates.
Stack Queue Hash Table
🔗
★★★ Advanced
Boolean Network
Kauffman NK Boolean networks. N binary nodes with K random inputs. K=1 ordered, K=2 critical, K≥3 chaotic.
Kauffman Complexity Canvas 2D
🖼️
New ★★★ Advanced
DCT Image Compression (JPEG Principle)
Discrete Cosine Transform compresses an 8×8 pixel block like JPEG. DCT-II: X_k = 2·Σx_n·cos(π(2n+1)k...
DCT JPEG Compression Canvas 2D
📡
New ★★★ Advanced
Polar Codes — Channel Capacity
Polar codes (Arıkan 2009) achieve Shannon capacity for binary-input symmetric channels. Channel pola...
Polar Codes Shannon Error Correction Canvas 2D
🧬
New ★★★ Advanced
Differential Evolution Optimizer
Differential Evolution (DE/rand/1/bin): mutant v = x_r1 + F(x_r2 - x_r3), crossover at rate CR. Self...
Differential Evolution Optimization Metaheuristic Canvas 2D
>Boids Algorithm: flocks and swarms Reynolds' three rules. Spatial hashing implementation. Scaling to 10,000 agents. Article A* and Pathfinding Algorithms Dijkstra vs Greedy vs A*. Heuristic functions. Navigation meshes in 3D space. Article Genetic Algorithms Selection, crossover, mutation. Travelling salesman problem. Evolutionary neural network training.

About Algorithms & AI Simulations

Pathfinding, sorting, neural networks, and search — made visual

Algorithms and AI simulations visualise the step-by-step execution of computer science's most important techniques. Watch A* and Dijkstra explore a maze and compare the paths they discover; observe a genetic algorithm evolve solutions to the Travelling Salesman Problem generation by generation; see a neural network adjust its weights in real time as it learns XOR or digit classification; follow how ant colony optimisation lays pheromone trails to find shortest routes.

Visualising algorithms makes abstract complexity tangible. You can pause playback, adjust heuristic weights, change maze topology, or tweak mutation rates and immediately see how performance changes. These are not toy examples — the same A* heuristic guides characters in AAA games, the same backpropagation trains production neural networks, and the same ACO logic optimises logistics routes in industry.

Algorithm visualisations are one of the most effective learning tools in computer science education. Watching A* expand nodes on a grid, or seeing bubble sort and merge sort side by side, builds an intuition for algorithmic complexity that no amount of reading can replace. These simulations are used in university courses worldwide to teach data structures, graph theory, and machine learning fundamentals.

Key Concepts

Topics and algorithms you'll explore in this category

A* PathfindingHeuristic-based optimal graph search
Genetic AlgorithmsEvolutionary optimisation: selection, crossover, mutation
Neural NetworksFeedforward networks with backpropagation
Sorting AlgorithmsBubble, merge, quick, heap — visualised
TSP / CombinatoricsNP-hard route optimisation
Boids / SteeringEmergent behaviour from local agent rules

Frequently Asked Questions

Common questions about this simulation category

How does A* find the shortest path?
A* combines Dijkstra's cost-so-far (g) with a heuristic estimate of remaining cost (h). The priority queue always expands the node with lowest f = g + h. With an admissible heuristic (never over-estimates), A* is guaranteed to find the optimal path in O(E log V) time.
What is the Travelling Salesman simulation?
The TSP simulation visualises several meta-heuristics — nearest neighbour, 2-opt improvement, and ant colony optimisation — attacking the classic NP-hard problem of finding the shortest tour through all cities. You can compare their quality and speed interactively.
How does the neural network simulation learn?
The network is trained with stochastic gradient descent and backpropagation. You can watch weights update in real time as the network learns XOR, a spiral classification, or digit recognition. Adjusting the learning rate and hidden-layer size demonstrates the bias-variance trade-off visually.

Other Categories

Every Algorithms & AI simulation here is free, browser-based and built for hands-on learning. Each interactive Algorithms & AI model lets you change the inputs — paint walls for A* pathfinding, adjust mutation rates for a genetic algorithm, or reshuffle bars for a sorting visualiser — and watch the consequences update in real time. From classic data structures and graph traversal to optimisation and machine learning, this is a practical way to learn Algorithms & AI online. The same methods drive real-world applications such as GPS route planning, where pathfinding finds the fastest road, and robotics, logistics, compression and game AI.