A beautiful, interactive 3D algorithm visualizer with MySQL database backend for tracking algorithm performance and statistics.
- Sorting: Bubble Sort, Quick Sort, Merge Sort, Heap Sort, Insertion Sort, Selection Sort
- Searching: Linear Search, Binary Search, Jump Search, Interpolation Search
- Pathfinding: A*, Dijkstra's, BFS, DFS
- Graph Visualization: Visual graph algorithm demonstrations
- โจ Beautiful 3D animations with glass-morphism UI
- ๐ Real-time performance tracking (comparisons, swaps, execution time)
- ๐พ MySQL database integration for statistics
- ๐ Performance analytics and history
- ๐๏ธ Adjustable array size and speed controls
- โธ๏ธ Pause/Resume functionality
- ๐ RESTful API for data persistence
# Navigate to project directory
cd /path/to/Algorithm-Visualizer
# Make setup script executable
chmod +x setup.sh
# Run setup
./setup.sh
# Edit .env with your MySQL credentials
nano .env
# Start the server
npm start# Navigate to project directory
cd C:\path\to\Algorithm-Visualizer
# Run setup
setup.bat
# Edit .env with your MySQL credentials
# Then start the server
npm start# 1. Install dependencies
npm install
# 2. Create .env file with your MySQL credentials
PORT=3001
MYSQL_HOST=localhost
MYSQL_USER=root
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=algorithm_visualizer
MYSQL_PORT=3306
NODE_ENV=development
# 3. Create MySQL database
mysql -u root -p
CREATE DATABASE algorithm_visualizer;
exit
# 4. Start server
npm start
# 5. Open http://localhost:3001 in browser- Select Algorithm Category: Choose from Sorting, Searching, Pathfinding, or Graph
- Pick Algorithm: Select specific algorithm from dropdown
- Configure: Adjust array size and speed with sliders
- Visualize: Click "Start" to begin animation
- Control: Use Pause/Resume and Reset buttons
- Track: Statistics are automatically saved to MySQL
# Save sorting result
POST /api/visualizations/sorting
Body: {
"algorithmName": "bubble",
"arraySize": 50,
"comparisons": 1225,
"swaps": 612,
"executionTime": 2.45
}
# Get all visualizations
GET /api/visualizations
# Get by type
GET /api/visualizations/type/sorting# Get algorithm stats
GET /api/algorithms/stats/bubble
# Get summary
GET /api/visualizations/stats/summaryPOST /api/visualizations/pathfinding
Body: {
"algorithmName": "astar",
"gridSize": "20x30",
"pathLength": 25,
"nodesExplored": 150,
"executionTime": 0.85
}- id: INT (Primary Key)
- algorithm_name: VARCHAR(255)
- algorithm_type: VARCHAR(100)
- array_size: INT
- comparisons: INT
- swaps: INT
- execution_time: FLOAT
- timestamp: DATETIME- id: INT (Primary Key)
- algorithm_name: VARCHAR(255) (UNIQUE)
- avg_comparisons: FLOAT
- avg_swaps: FLOAT
- min_time: FLOAT
- max_time: FLOAT
- total_runs: INT- id: INT (Primary Key)
- algorithm_name: VARCHAR(255)
- grid_size: VARCHAR(50)
- path_length: INT
- nodes_explored: INT
- execution_time: FLOAT
- timestamp: DATETIME- Frontend: Vanilla JavaScript, HTML5, CSS3
- Backend: Node.js, Express.js
- Database: MySQL
- APIs: RESTful
Algorithm-Visualizer/
โโโ index.html # Main UI
โโโ server.js # Express server
โโโ package.json # Dependencies
โโโ .env # Configuration
โโโ setup.sh / setup.bat # Setup scripts
โโโ config/
โ โโโ database.js # MySQL connection
โโโ routes/
โ โโโ algorithms.js # Algorithm endpoints
โ โโโ visualizations.js # Visualization endpoints
โโโ js/
โ โโโ api-client.js # API communication
โ โโโ algorithms.js # Algorithm implementations
โ โโโ visualizer.js # Visualization logic
โ โโโ utils.js # Utility functions
โโโ css/
โ โโโ style.css # Styling
โโโ SETUP_GUIDE.md # Detailed setup guide
Edit .env file to configure:
# Server
PORT=3001
NODE_ENV=development
# MySQL Database
MYSQL_HOST=localhost
MYSQL_USER=root
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=algorithm_visualizer
MYSQL_PORT=3306- Clear browser cache (Ctrl+Shift+Delete)
- Check console for errors (F12)
- Restart server
- Verify MySQL is running:
mysql -u root -p - Check .env credentials
- Database exists:
CREATE DATABASE algorithm_visualizer;
Edit .env and change PORT to another number (3002, 3003, etc.)
Tables are auto-created on first run. If issues:
DROP DATABASE algorithm_visualizer;
# Restart server - it will recreate all tables- Use smaller array sizes (10-50) for smooth visualization
- Increase speed for better responsiveness
- Run on modern browser (Chrome, Firefox, Edge)
- Use pathfinding with smaller grids (10x15 to 20x30)
| Browser | Support |
|---|---|
| Chrome | โ Full |
| Firefox | โ Full |
| Edge | โ Full |
| Safari | โ Full |
| IE 11 | โ No |
- Advanced graph algorithms
- More sorting algorithms (Radix, Counting, Bucket)
- Algorithm comparison mode
- Export visualization as video/image
- Real-time multiplayer mode
- Advanced filtering in statistics dashboard
MIT License - feel free to use this project
Contributions welcome! Feel free to submit issues and pull requests.
For issues and questions:
- Check browser console (F12) for error messages
- Review SETUP_GUIDE.md for detailed instructions
- Verify MySQL is running and credentials are correct
Enjoy visualizing algorithms! ๐
