A beautiful, interactive web platform for visualizing Data Structures and Algorithms. Watch algorithms come to life with stunning animations, step-by-step breakdowns, and comprehensive explanations.
- ๐จ Modern UI/UX - Sleek dark theme with glassmorphism effects and smooth animations
- โฏ๏ธ Full Playback Control - Play, pause, step forward/backward, and scrub through algorithm execution
- ๐๏ธ Adjustable Speed - Control animation speed from 0.25x to 4x
- ๐ Real-time Stats - Track moves, comparisons, and current step
- ๐ Comprehensive Explanations - Each algorithm includes overview, step-by-step guide, pseudocode, and real-world applications
- ๐ Search & Filter - Quickly find algorithms by name or category
- ๐ฑ Responsive Design - Works on desktop and tablet devices
- โจ๏ธ Keyboard Shortcuts - Space to play/pause, arrow keys to step through
| Algorithm | Time Complexity | Space Complexity |
|---|---|---|
| Merge Sort | O(n log n) | O(n) |
| Quick Sort | O(n log n) avg | O(log n) |
| Algorithm | Description |
|---|---|
| Dijkstra's Algorithm | Find shortest paths in weighted graphs |
| A Pathfinding* | Intelligent pathfinding with heuristics |
| Graph Traversal (BFS/DFS) | Explore graphs systematically |
| Algorithm | Description |
|---|---|
| Tower of Hanoi | Classic recursive disk-moving puzzle |
| N-Queens Problem | Place N queens without conflicts |
| Sudoku Solver | Solve puzzles with backtracking |
| Algorithm | Description |
|---|---|
| Binary Search Tree | Insert, search, and traverse BST operations |
| Algorithm | Time Complexity | Space Complexity |
|---|---|---|
| Longest Common Subsequence (LCS) | O(m ร n) | O(m ร n) |
| Algorithm | Time Complexity | Space Complexity |
|---|---|---|
| KMP String Matching | O(n + m) | O(m) |
- Node.js (for local development server)
- Modern web browser (Chrome, Firefox, Edge, Safari)
-
Clone the repository
git clone https://github.com/yourusername/dsa-algorithm-visualizer.git cd dsa-algorithm-visualizer -
Start the development server
npx serve frontend -l 5000
-
Open in browser
http://localhost:5000
dsa-algorithm-visualizer/
โโโ frontend/
โ โโโ index.html # Homepage
โ โโโ algorithm.html # Algorithm visualization page
โ โโโ css/
โ โ โโโ styles.css # Main styles
โ โ โโโ algorithm.css # Algorithm page styles
โ โ โโโ animations.css # Animation utilities
โ โโโ js/
โ โโโ main.js # Homepage logic
โ โโโ algorithms/ # Algorithm implementations
โ โ โโโ towerOfHanoi.js
โ โ โโโ nQueens.js
โ โ โโโ mergeSort.js
โ โ โโโ quickSort.js
โ โ โโโ dijkstra.js
โ โ โโโ aStar.js
โ โ โโโ bst.js
โ โ โโโ sudoku.js
โ โ โโโ kmp.js
โ โ โโโ graphTraversal.js
โ โ โโโ lcs.js
โ โโโ visualizers/ # Visualization components
โ โ โโโ tower-of-hanoi.js
โ โ โโโ n-queens.js
โ โ โโโ merge-sort.js
โ โ โโโ quick-sort.js
โ โ โโโ dijkstra.js
โ โ โโโ a-star.js
โ โ โโโ bst.js
โ โ โโโ sudoku.js
โ โ โโโ kmp.js
โ โ โโโ graph-traversal.js
โ โ โโโ lcs.js
โ โโโ utils/
โ โโโ animator.js # Animation controller
โโโ README.md
- Browse available algorithms organized by category
- Use the search bar to find specific algorithms
- Filter by category (Sorting, Pathfinding, Backtracking, etc.)
- Click on any algorithm card to view its visualization
- Play/Pause - Start or stop the animation
- Step Forward/Back - Move through algorithm steps manually
- Reset - Return to initial state
- Speed Slider - Adjust animation speed
- Progress Bar - Click anywhere to jump to that step
- Tabs - Switch between Overview, Steps, Applications, and Code
| Key | Action |
|---|---|
Space |
Play/Pause |
โ |
Step backward |
โ |
Step forward |
R |
Reset |
Create a new file in frontend/js/algorithms/:
// frontend/js/algorithms/myAlgorithm.js
export class MyAlgorithm {
constructor() {
this.states = [];
}
// Your algorithm logic here
solve() {
this.states = [];
// Add states as algorithm progresses
this.states.push({
// State data for visualization
description: 'Step description'
});
}
}
export default MyAlgorithm;Create a new file in frontend/js/visualizers/:
// frontend/js/visualizers/my-algorithm.js
import { MyAlgorithm } from '../algorithms/myAlgorithm.js';
import { AnimationController } from '../utils/animator.js';
const info = {
title: 'My Algorithm',
description: '...',
overview: '...',
steps: '...',
applications: '...',
code: '...'
};
let algorithm, animator, canvas, ctx;
let states = [], currentState = null;
export function init() {
setupDOM();
setupControls();
setupAlgorithm();
setupCanvas();
}
// Implement setupDOM, setupControls, setupAlgorithm, setupCanvas, draw, etc.
export default { init };- Add to the visualizers mapping in
algorithm.html - Add to the algorithms array in
main.js
Edit the CSS custom properties in styles.css:
:root {
--color-primary: #3b82f6;
--color-accent: #8b5cf6;
--color-success: #10b981;
--color-warning: #f59e0b;
--color-error: #ef4444;
--color-bg-primary: #0f172a;
--color-bg-secondary: #1e293b;
}Adjust the step duration in each visualizer's setupAlgorithm():
animator.stepDuration = 500; // milliseconds between stepsContributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-algorithm) - Commit your changes (
git commit -m 'Add amazing algorithm') - Push to the branch (
git push origin feature/amazing-algorithm) - Open a Pull Request
- Add new algorithms (Heap Sort, Bellman-Ford, Floyd-Warshall, etc.)
- Improve visualizations
- Add mobile responsiveness
- Add dark/light theme toggle
- Add algorithm comparison mode
- Add export/share functionality
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspiration from various algorithm visualization platforms
- Icons and design influenced by modern UI trends
- Built with vanilla JavaScript, HTML5 Canvas, and CSS3
Made with โค๏ธ for learning algorithms