Interactive visualizations for data structures and algorithms
Step through algorithms at your own pace. See how the code executes. Build real intuition.
Topics β’ Features β’ Get Started β’ Structure β’ Tech Stack
DS-Algo Playground is a zero-dependency, pure HTML/CSS/JavaScript web app that helps you understand data structures and algorithms through interactive, step-by-step canvas visualizations.
No frameworks. No build tools. No installs. Just open and learn.
Every topic includes:
- A clear explanation of how the algorithm works
- An interactive canvas visualization β play, pause, step through, adjust speed
- Code implementations in Python, Java, and C++
- Complexity analysis with time & space breakdowns
- A quiz to test your understanding
| Topic | Description |
|---|---|
| Arrays | Access, insert, delete, and search operations with shifting animation |
| Linked Lists | Singly linked list traversal and pointer manipulation |
| Stack | Push, pop, and peek with vertical column visualization |
| Queue | Enqueue, dequeue with front/rear pointer tracking |
| Hash Table | Hash function visualization, collision resolution with chaining |
| Binary Search Tree | Insert, search, delete, and inorder/preorder/postorder traversals |
| Heap | Max-heap with synchronized tree + array dual view |
| Topic | Description |
|---|---|
| Bubble Sort | Adjacent-swap sorting with early-termination optimization |
| Selection Sort | Scan for minimum, swap into sorted position |
| Insertion Sort | Key-lift, shift-right, and drop-in-place insertion |
| Merge Sort | Recursive divide phase and merge phase visualization |
| Quick Sort | Pivot partitioning with left/right pointer scanning |
| Topic | Description |
|---|---|
| Binary Search | Divide-and-conquer search with low/mid/high pointers |
| BFS | Breadth-first graph traversal with queue visualization |
| DFS | Depth-first graph traversal with stack and backtracking |
| Topic | Description |
|---|---|
| Two Pointers | Converging pointers for pair-sum in sorted arrays |
| Sliding Window | Fixed-size window for maximum subarray sum |
| Dynamic Programming | Tabulation-based Fibonacci with DP table filling |
| Recursion | Fibonacci call tree with recursive DFS traversal |
Every algorithm is rendered on an HTML5 Canvas with full playback controls β play, pause, step forward/back, reset, and adjustable speed. Each step includes a plain-English explanation of what's happening and why.
Pick any two sorting algorithms and run them side-by-side on the same input array. Compare their approaches, step counts, and behavior visually.
Watch 5 sorting algorithms race on the same array simultaneously. Progress bars and a winner announcement show you which algorithm finishes first.
Interactive plot of O(1), O(log n), O(n), O(n log n), O(n^2), and O(2^n) growth curves. Adjust n with a slider and toggle individual curves on/off.
Every topic shows implementations in Python, Java, and C++ with syntax highlighting, tabbed navigation, and a one-click copy button.
Toggle between dark and light modes with t. Your preference is saved across sessions. Auto-detects OS preference on first visit.
Press ? on any page to see all shortcuts:
| Key | Action |
|---|---|
t |
Toggle theme |
/ |
Focus search |
Space |
Play / Pause visualization |
β β |
Step backward / forward |
? |
Show shortcuts modal |
Esc |
Close modal / search |
Completed topics are tracked with visual badges on the sidebar. Progress persists across sessions via localStorage.
Works on desktop, tablet, and mobile. Canvas visualizations resize to fit the viewport.
Visit the live site β no setup, no install, just open and learn.
If you'd like to contribute or run locally, see Contributing.
DS-Algo-Playground/
βββ index.html # Home page with topic grid
βββ compare.html # Side-by-side algorithm comparison
βββ race.html # Algorithm race (5 sorting algos)
βββ complexity.html # Big-O growth rate visualizer
βββ about.html # About page
β
βββ topics/ # 19 topic pages
β βββ arrays.html
β βββ linked-lists.html
β βββ stack.html
β βββ queue.html
β βββ hash-table.html
β βββ bst.html
β βββ heap.html
β βββ bubble-sort.html
β βββ selection-sort.html
β βββ insertion-sort.html
β βββ merge-sort.html
β βββ quick-sort.html
β βββ binary-search.html
β βββ bfs.html
β βββ dfs.html
β βββ two-pointers.html
β βββ sliding-window.html
β βββ dynamic-programming.html
β βββ recursion.html
β
βββ js/
β βββ visualization-core.js # Playback engine (play/pause/step/speed)
β βββ viz-utils.js # Shared drawing primitives
β βββ sidebar-nav.js # Dynamic sidebar from topics.json
β βββ code-trace.js # Code line highlighting + variable watch
β βββ challenge.js # Challenge mode infrastructure
β βββ main.js # App entry point and init router
β βββ progress.js # Progress tracking with badges
β βββ search.js # Fuzzy topic search
β βββ theme.js # Dark/light theme toggle
β βββ keyboard.js # Global keyboard shortcuts
β βββ quiz.js # Quiz scoring engine
β βββ code-block.js # Syntax highlighting + copy
β βββ sidebar.js # Sidebar open/close behavior
β βββ topics/ # 19 visualization modules
β βββ arrays-viz.js
β βββ linked-lists-viz.js
β βββ bubble-sort-viz.js
β βββ ... (one per topic)
β
βββ css/
β βββ main.css # CSS imports
β βββ variables.css # Theme color tokens
β βββ visualization.css # Canvas + controls + challenge styles
β βββ code-trace.css # Code highlighting styles
β βββ code.css # Code block styles
β βββ components.css # Buttons, cards, badges
β βββ layout.css # Grid and sidebar layout
β βββ topic.css # Topic page layout
β βββ reset.css # CSS reset
β
βββ data/
β βββ topics.json # Topic registry (drives sidebar + progress)
β βββ complexity-data.json # Big-O reference data
β
βββ .github/workflows/
βββ deploy.yml # GitHub Pages deployment
| Layer | Technology |
|---|---|
| Rendering | HTML5 Canvas 2D API |
| Language | Vanilla JavaScript (ES5, IIFE modules) |
| Styling | CSS Custom Properties for dark/light theming |
| Storage | localStorage for progress + theme persistence |
| Hosting | GitHub Pages via GitHub Actions |
| Dependencies | None β zero external libraries |
This project is built purely for educational purposes β to help students, self-learners, and developers understand data structures and algorithms through interactive visualizations.
Contributions are welcome and encouraged! Whether it's:
- Adding a new topic or algorithm
- Improving an existing visualization
- Fixing bugs or typos
- Enhancing mobile responsiveness
- Translating content
Feel free to open an issue or submit a pull request.
MIT License. See LICENSE for details.
Built with the help of AI (Claude) β prompted, guided, and curated by a human.