Algorithm Arcade
Everything runs in your browser. Switch tabs below 👇
Goal: find the shortest path on a grid, avoiding walls.
- Click cells to toggle walls.
- Start is green (top-left), goal is red (bottom-right).
How it works
A* explores nodes with priority f(n)=g(n)+h(n) where g is distance from start and h is a heuristic (here: Manhattan distance). With an admissible h, A* returns an optimal path.
Why it’s used: games, maps, routing.
Goal: minimize a function with gradient‐based steps. Try a non-convex surface to see traps, noise to “shake” out of basins, or momentum to speed valleys.
How it works
Update rule with momentum & noise:
v ← β·v + (1−β)·(∇f(x) + 𝒩(0,σ²I)),
x ← x − η·v. When β=0 and σ=0 this reduces to vanilla GD.
- Quadratic bowl: convex; any start converges.
- Himmelblau: multiple minima; can get stuck near different solutions.
- Rastrigin: many local minima; small noise sometimes helps escape.
Goal: demonstrate a memory-efficient set structure with false positives.
- Add some words, then query others.
- Bloom filter replies “maybe” when all hashed bits are 1 (can be false positive), never false negative.
How it works
We use an array of m bits and k hash functions. To add key s, set bits at indices h_i(s). To query, check those bits; if any is 0 → “definitely not present”, else → “maybe present”.
Why it’s used: web caches, databases, network deduplication.