An interactive web application for visualizing dynamic programming algorithms through multiple perspectives: recursion trees, memoization, and tabulation.
-
Multi-Perspective Visualization: View algorithms through three different lenses
- Recursion Tree: Interactive canvas with pan/zoom capabilities
- Memoization: Call stack and cache visualization with animated connections
- DP Table: Step-by-step table building with dependency tracking
-
Interactive Controls:
- Play/Pause animation
- Step forward/backward through execution
- Adjustable speed (50ms - 2000ms per step)
- Reset functionality
-
Supported Problems:
- Fibonacci Sequence
- Coin Change
- 0/1 Knapsack
- Longest Common Subsequence (LCS)
-
Real-Time Statistics:
- Recursive call count
- Time complexity analysis
- Space complexity tracking
- React 18 with TypeScript
- Vite for fast development and builds
- HTML5 Canvas for tree visualization
- CSS Grid & Flexbox for responsive layout
- Node.js (v16 or higher)
- npm or yarn
- Clone the repository:
git clone <repository-url>
cd "Dynamic Programming Visulazer"- Install dependencies:
npm install- Start the development server:
npm run dev- Open your browser and navigate to
http://localhost:5173
npm run buildThe production-ready files will be in the dist folder.
npm run preview- Select a Problem: Choose from Fibonacci, Coin Change, Knapsack, or LCS
- Configure Inputs: Enter problem-specific parameters (numbers, arrays, strings)
- Click Visualize: Generate the visualization
- Explore Views: Switch between Tree, Memoization, and DP Table tabs
- Control Playback: Use play/pause, step controls, and speed adjustment
- Interact with Tree: Drag to pan, scroll to zoom in the recursion tree view
The visualizer executes dynamic programming algorithms and records each computational step. These steps are then replayed as animations, allowing you to see how the algorithm builds solutions incrementally. The caching system ensures smooth switching between different visualization modes without recomputing.
Each algorithm implements three approaches:
- Recursive (Tree): Shows overlapping subproblems
- Memoized (Top-down DP): Demonstrates caching optimization
- Tabulated (Bottom-up DP): Illustrates iterative table building
This project is licensed under the MIT License - see the LICENSE.txt file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Built with modern web technologies for educational purposes to help understand dynamic programming concepts through interactive visualization.