HomeComputer ScienceComputational Complexity Explorer

Computational Complexity Explorer

Interactive computational complexity explorer: compare O(1), O(log n), O(n), O(n log n), O(n^2) and O(2^n) growth on a log-scale chart with real computed times, then watch a brute-force Travelling Salesman solver demonstrate why verifying a solution is fast (P) while finding the optimum by exhaustive search explodes combinatorially (NP).

Computer Science2DModerate60 FPS
computational-complexity ↗ Open standalone

This simulator makes the abstract notation of computational complexity theory concrete. The growth-rate chart plots six standard complexity classes — O(1), O(log n), O(n), O(n log n), O(n²) and O(2^n) — on a shared logarithmic axis and converts each one's operation count at the current problem size into an actual duration at one billion operations per second, so the gap between "fast" and "intractable" is measured in real milliseconds, seconds and minutes rather than abstract symbols. The second panel demonstrates the P vs NP distinction directly through the Travelling Salesman Problem: verifying a proposed tour's length is linear-time and instant, while finding the guaranteed-shortest tour by exhaustive brute force requires trying every permutation of the remaining cities — a factorial search space that visibly explodes as the city count grows from 5 to 8.

⚙ Under the hood

Live growth-rate chart comparing O(1), O(log n), O(n), O(n log n), O(n^2) and O(2^n) with real computed times at 1 billion ops/sec, plus a brute-force Travelling Salesman solver showing O(n) verification versus O(n!) exhaustive search.

algorithmscomplexity theorybig-op vs nptraveling salesmancomputer sciencecombinatorics

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)