Visualize. Compare. Benchmark.
AlgoRace is a high-performance full-stack web application designed for real-time visualization, multi-lane comparison, step-by-step debugging, and scientific benchmarking of classic computer science algorithms.
- Frontend Application: https://algorithm-race-visualizer.vercel.app
- Backend API: Spring Boot 3.4 REST Engine (Render / Local)
"I built AlgoRace because Big-O notation and static pseudocode never fully captured how algorithms actually behave for me. $O(n \log n)$ tells you the growth rate, but it doesn't show you why Quick Sort pulls ahead of Bubble Sort on the same dataset, or how Dijkstra's algorithm actually explores a graph step by step.
AlgoRace turns that into something you can watch and interact with. Sorting algorithms race side by side on identical dataset seeds, search algorithms visualize their space elimination as it happens, and pathfinding runs on 2D grids you can edit and re-run in real time.
It's a full-stack project: a Spring Boot Java backend generates deterministic simulation steps, a React 18 + TypeScript frontend renders them on HTML5 Canvas, and a custom Web Audio synthesizer adds sound feedback for comparisons and swaps."
β Muhammad Sanan Sarwar (Creator & Lead Engineer)
- 18+ Algorithms Supported: Multi-lane comparison across Sorting, Searching, and Pathfinding.
- Deterministic Dataset Preservation: All algorithms race on identical, un-biased dataset seeds for scientifically accurate benchmarking.
- Step-by-Step Debugger & Frame Scrubbing: Scrub backward and forward through algorithm execution timelines with interactive seek bars.
- Interactive 2D Grid Wall Editor: Click and drag directly on the pathfinding canvas to construct custom wall barriers with live path recalculation.
- Synthesized Web Audio Engine: Multi-lane vibraphone-style acoustic feedback that continues until the final algorithm completes.
- Core Web Vitals Optimized: CSS
aspect-ratiolayout reservation eliminating CLS,IntersectionObservercanvas offscreen pausing, mobile hardware detection, and code splitting viaReact.lazy+Suspense. - Hardened Production Security: Strict CORS origin mapping, input sanitization, and DoS array/grid bounds checking (
MAX_ARRAY_SIZE = 100,MAX_GRID_COLS = 60).
Compare comparison and non-comparison sorting algorithms side-by-side on identical array seeds:
-
Supported Algorithms (9):
-
Quick Sort β
$O(n \log n)$ best/avg,$O(n^2)$ worst,$O(\log n)$ space. -
Merge Sort β
$O(n \log n)$ best/avg/worst,$O(n)$ space. -
Heap Sort β
$O(n \log n)$ best/avg/worst,$O(1)$ space. -
Insertion Sort β
$O(n)$ best,$O(n^2)$ avg/worst,$O(1)$ space. -
Selection Sort β
$O(n^2)$ best/avg/worst,$O(1)$ space. -
Bubble Sort β
$O(n)$ best,$O(n^2)$ avg/worst,$O(1)$ space. -
Comb Sort β
$O(n \log n)$ best,$O(n^2 / 2^p)$ avg,$O(n^2)$ worst,$O(1)$ space. -
Radix Sort β
$O(nk)$ best/avg/worst,$O(n+k)$ space (Digit bucket distribution). -
Counting Sort β
$O(n+k)$ best/avg/worst,$O(k)$ space (Frequency count array).
-
Quick Sort β
-
Dataset Modes: Random, Nearly Sorted, Reversed, Few Unique, Custom Array Input.
Benchmark searching algorithms on ordered array spaces with active target probe visualization:
-
Supported Algorithms (5):
-
Linear Search β
$O(1)$ best,$O(n)$ avg/worst. -
Binary Search β
$O(1)$ best,$O(\log n)$ avg/worst (Search space halving). -
Jump Search β
$O(1)$ best,$O(\sqrt{n})$ avg/worst (Block step jumping). -
Exponential Search β
$O(1)$ best,$O(\log n)$ avg/worst (Doubling range finding + Binary Search). -
Interpolation Search β
$O(1)$ best,$O(\log \log n)$ avg,$O(n)$ worst (Key distribution position estimation).
-
Linear Search β
Visualize graph traversal and shortest-path calculation on custom 2D grid maps:
-
Supported Algorithms (5):
- A* Search β Heuristic-guided optimal pathfinding combining distance & Manhattan heuristic.
- Dijkstra's Algorithm β Guaranteed shortest-path tree exploration for weighted graphs.
- Breadth-First Search (BFS) β Unweighted graph shortest-path queue traversal.
- Depth-First Search (DFS) β Deep-first stack maze exploration and cycle detection.
- Bellman-Ford Algorithm β Relaxation-based shortest path algorithm iteratively relaxing grid edges.
-
Maze Generators: Random Noise, Recursive Division, Simple Spiral, Clear Grid.
Synthesized acoustic chimes provide subtle auditory feedback for array swaps, comparisons, search hits, and victory fanfares:
| Event | Tone Def | Description |
|---|---|---|
| Race Start |
[60,64] [67,72]
|
Ascending two-chord tone |
| Compare | [72, 79] |
Soft high sine ping |
| Swap | [50, 57, 62] |
Deep triangle bass chord |
| Search Hit | [72, 76] |
Bright cyan chime |
| Search Miss | [60, 63] |
Soft descending triangle tone |
| Path Found |
[64,67,72] [67,72,76]
|
Gentle resolution chord |
| Race Complete |
[60,64,67] [67,72,76]
|
Warm dual chord |
| Winner |
[60,64] [64,67] [67,72,76,79]
|
Three-tone victory fanfare |
Audio feedback evaluates active status across all lanes, continuing seamlessly until the last running algorithm completes.
- Framework: React 18 with TypeScript & Vite
- Styling: Vanilla CSS3 with Obsidian Dark & Light theme design system
- Visuals: HTML5 Canvas (Hardware-accelerated 2D context)
- Audio: Native Web Audio API Synthesizer
- Language: Java 21 / 25
- Framework: Spring Boot 3.4.2 REST Engine
- Build Tool: Maven
AlgoRace/
β
βββ frontend/ # React 18 + TypeScript + Vite Client
β βββ src/
β β βββ components/ # Canvas renderers, Controls, LaneCards, Comparison Center
β β βββ context/ # AudioContext state provider
β β βββ data/ # Fallback algorithm catalogs & metadata
β β βββ hooks/ # usePlayback, useSound, useAudioSettings
β β βββ models/ # TypeScript interfaces & API types
β β βββ pages/ # Sorting, Searching, Pathfinding, History, Settings
β β βββ services/ # API HTTP client
β β βββ styles.css # Dark & Light theme design system
β βββ package.json
β
βββ backend/ # Spring Boot 3.4 API Engine
β βββ src/main/java/com/algorithmrace/visualizer/
β βββ algorithms/ # Sorting, Searching, Pathfinding step generators
β βββ controller/ # REST Controllers
β βββ dto/ # Data Transfer Objects
β βββ model/ # Base Algorithm models
β βββ service/ # Simulation engine & Catalog services
β βββ utils/ # Array & Maze generators
β
βββ README.md
git clone https://github.com/Sanan507/AlgorithmRaceVisualizer.git
cd AlgorithmRaceVisualizercd backend
mvn spring-boot:runBackend server runs on http://localhost:8080.
cd frontend
npm install
npm run devFrontend application runs on http://localhost:5173.
-
Input Sanitization: Array size bounded (
$2 \le N \le 100$ ), grid dimensions capped ($5 \le R \le 40, 5 \le C \le 60$ ), and algorithm lanes limited to max 6 concurrent lanes per race. -
CORS Protection: Restricted allowed origins mapped via
application.yml(CORS_ALLOWED_ORIGINS). -
Layout Preservation: Bounding aspect ratio (
580/260) reserved in CSS, eliminating Cumulative Layout Shift (CLS).
- Author: Muhammad Sanan Sarwar
- Email: sanansarwar567@gmail.com
- LinkedIn: sanan-sarwar
- GitHub: Sanan507
- License: MIT License (Permissive Open Source)


