Skip to content

AlgoVisualizer is a web-based, interactive platform designed to help users understand complex Data Structures and Algorithms (DSA) by visualizing their step-by-step execution. Built with React and Tailwind CSS, it provides a clean, modern, and intuitive interface for learning.

License

Notifications You must be signed in to change notification settings

mahaveergurjar/AlgoVisualizer

🎨 AlgoVisualizer

AlgoVisualizer Banner

An Interactive Web Platform for Visualizing Algorithms and Data Structures

Live Demo React Vite License Hacktoberfest

Live Demo β€’ Report Bug β€’ Request Feature


  • βœ… Bubble Sort (Implemented)
  • βœ… Merge Sort (Implemented)
  • βœ… Quick Sort (Implemented)
  • βœ… Selection Sort (Implemented)
  • βœ… Insertion Sort (Implemented)
  • βœ… Heap Sort (Implemented)
  • βœ… Counting Sort (Implemented)
  • βœ… Radix Sort (Implemented)

AlgoVisualizer is a modern, interactive web application designed to help students, developers, and algorithm enthusiasts understand complex Data Structures and Algorithms (DSA) through visual, step-by-step execution. Whether you're preparing for technical interviews, studying for exams, or simply curious about how algorithms work under the hood, AlgoVisualizer makes learning engaging and intuitive.

✨ Why AlgoVisualizer?

  • 🎯 Visual Learning: See algorithms in action with real-time, animated visualizations
  • πŸš€ Interactive Controls: Adjust speed, pause, and step through algorithms at your own pace
  • 🎨 Modern UI: Clean, responsive interface built with React and Tailwind CSS
  • πŸ“š Comprehensive Coverage: From basic sorting to advanced pathfinding algorithms
  • πŸ”§ Educational Focus: Perfect for students, teachers, and self-learners
  • πŸ’» No Installation: Run directly in your browser

  • Interactive Controls:
    • Step-by-step algorithm visualization
    • Interactive forward/backward navigation
    • Real-time complexity metrics (comparisons, swaps, merges)
    • Educational explanations for each step
    • Keyboard navigation support (arrow keys)
    • Visual representation of algorithm steps

πŸ› οΈ Built With

Technology Description
React Frontend framework for building UI
Vite Fast build tool and dev server
Tailwind CSS Utility-first CSS framework
JavaScript Programming language
Vercel Deployment platform

πŸ“ Project Structure

AlgoVisualizer/
β”œβ”€β”€ public/                  # Static assets
β”‚   └── algo.svg            # Vite logo
β”œβ”€β”€ src/                    # Source files
β”‚   β”œβ”€β”€ components/         # React components
β”‚   β”œβ”€β”€ pages/
|   |   β”œβ”€β”€ Arrays            # Array Data Structure
|   |   β”œβ”€β”€ BinarySearch      # Binary Search Questions
|   |   β”œβ”€β”€ Graph             # Graph Data Structure
|   |   β”œβ”€β”€ BitManipulation   # Bit Manipulation Questions
|   |   β”œβ”€β”€ DynamicProgramming # Dynamic Programming Questions
|   |   β”œβ”€β”€ Deque            # Deque Data Structure
|   |   β”œβ”€β”€ GreedyAlgorithms # Greedy Algorithms Question
|   |   β”œβ”€β”€ Hashing          # Hashing Data Structure
|   |   β”œβ”€β”€ LinkedList       # Linked List Data Structure
|   |   β”œβ”€β”€ Pathfinding      # Pathfinding Algorithms Question
|   |   β”œβ”€β”€ Queue            # Queue Data Structure
|   |   β”œβ”€β”€ Recursion        # Recursion Question
|   |   β”œβ”€β”€ Stack            # Stack Data Structure
|   |   β”œβ”€β”€ Strings          # Strings Data Structure
|   |   β”œβ”€β”€ Tree             # Tree Data Structure
|   |   β”œβ”€β”€ Trie             # Trie Data Structure
|   |   β”œβ”€β”€ Sorting          # Sorting Algorithms Question
|   |   β”œβ”€β”€ SlidingWindows   #Sliding Window Algorithm Question
|   |   └── Heaps    # Heaps
β”‚   β”œβ”€β”€ search/         # Search 
β”‚   β”‚   └── catalog.js/    # Catalog of algorithms
β”‚   β”œβ”€β”€ App.jsx            # Main App component
β”‚   β”œβ”€β”€ App.css            # Global styles
β”‚   β”œβ”€β”€ main.jsx           # Entry point
β”‚   └── index.css          # Base CSS
β”œβ”€β”€ .gitignore             # Git ignore rules
β”œβ”€β”€ index.html             # HTML template
β”œβ”€β”€ package.json           # Dependencies and scripts
β”œβ”€β”€ vite.config.js         # Vite configuration
└── README.md              # Project documentation

πŸš€ Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (v14.0 or higher)
  • npm (v6.0 or higher) or yarn

Installation

  1. Clone the repository

    git clone https://github.com/mahaveergurjar/AlgoVisualizer.git
    cd AlgoVisualizer
  2. Install dependencies

    npm install
    # or
    yarn install
  3. Start the development server

    npm run dev
    # or
    yarn dev
  4. Open your browser

    Navigate to http://localhost:5173 to view the application.

Build for Production

npm run build
# or
yarn build

The optimized production build will be generated in the dist/ folder.


πŸ’‘ Usage

Sorting Visualizer

  1. Select a sorting algorithm from the dropdown menu
  2. Adjust the array size and speed using the sliders
  3. Click "Generate New Array" to create random data
  4. Press "Start" to begin the visualization
  5. Use "Pause/Resume" to control the execution
  6. Click "Reset" to return to the initial state

Pathfinding Visualizer

  1. Choose between Dijkstra's or A* algorithm
  2. Click on the grid to set walls/obstacles
  3. Set start and end points
  4. Adjust visualization speed
  5. Click "Visualize" to see the algorithm in action

Graph Algorithms

  1. Select DFS or BFS
  2. Click nodes to create a graph structure
  3. Choose a starting node
  4. Watch the traversal process unfold

🀝 Contributing

We welcome contributions from developers of all skill levels! Whether it's fixing bugs, adding features, improving documentation, or suggesting ideas, your help is appreciated.

How to Contribute

  1. Fork the repository

    git clone https://github.com/YOUR-USERNAME/AlgoVisualizer.git
  2. Create a feature branch

    git checkout -b feature/AmazingFeature
  3. Make your changes

    • Write clean, readable code
    • Follow the existing code style
    • Add comments where necessary
    • Test your changes thoroughly
  4. Commit your changes

    git commit -m 'Add some AmazingFeature'
  5. Push to your branch

    git push origin feature/AmazingFeature
  6. Open a Pull Request

    • Provide a clear description of your changes
    • Reference any related issues
    • Wait for review and feedback

Contribution Guidelines

  • βœ… Ensure your code follows the project's coding standards
  • βœ… Write meaningful commit messages
  • βœ… Test your changes before submitting
  • βœ… Update documentation if needed
  • βœ… Be respectful and constructive in discussions
  • βœ… Follow the standard visualization layout (see below)
  • ❌ Don't submit spam or low-quality PRs

πŸ“ Standard Visualization Layout Structure

All algorithm visualizations must follow this consistent layout for a uniform user experience:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  HEADER SECTION                                             β”‚
β”‚  - Problem Title (e.g., "Trapping Rain Water")              β”‚
β”‚  - Problem Description/LeetCode Number                      β”‚
β”‚  - Back to Problems Button                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  INPUT CONTROLS ROW                                         β”‚
β”‚  - Input Field (for array/data input)                       β”‚
β”‚  - Navigation Controls (Previous/Next Step)                 β”‚
β”‚  - Step Counter (e.g., "31/39")                             β”‚
β”‚  - Reset Button                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  ALGORITHM TABS (if multiple approaches)                    β”‚
β”‚  - Brute Force O(nΒ²)                                        β”‚
β”‚  - Optimal O(n)                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  LEFT PANEL              β”‚  RIGHT PANEL                     β”‚
β”‚                          β”‚                                  β”‚
β”‚  CODE SECTION            β”‚  VISUALIZATION SECTION           β”‚
β”‚  - Syntax highlighted    β”‚  - Main visual representation    β”‚
β”‚  - Line numbers          β”‚  - Interactive bars/nodes/graph  β”‚
β”‚  - Current line highlightβ”‚  - Color-coded elements          β”‚
β”‚  - Step-by-step execute  β”‚  - Animated transitions          β”‚
β”‚                          β”‚  - Current position indicator    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  DATA STRUCTURE DISPLAY (if applicable)                     β”‚
β”‚  - Arrays/Stacks/Queues being used                          β”‚
β”‚  - Show values at each step                                 β”‚
β”‚  - Highlight active elements                                β”‚
β”‚  Example:                                                   β”‚
β”‚    Left Max Array (lmax):  [0, 1, 1, 2, 2, 2, ...]          β”‚
β”‚    Right Max Array (rmax): [3, 3, 3, 3, 3, 2, ...]          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  OUTPUT SECTION                                             β”‚
β”‚  - Final result display                                     β”‚
β”‚  - Clear visual indicator                                   β”‚
β”‚  Example: "Total Trapped Water: 6"                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  EXPLANATION SECTION                                        β”‚
β”‚  - Step-by-step explanation of current operation            β”‚
β”‚  - Formula/logic being applied                              β”‚
β”‚  Example: "Water at index 4 = min(max[4], rmax[4])          β”‚
β”‚            - height[4] = min(2, 3) - 1 = 1"                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  COMPLEXITY ANALYSIS                                        β”‚
β”‚  - Time Complexity: O(n) with explanation                   β”‚
β”‚  - Space Complexity: O(n) with explanation                  β”‚
β”‚  - Brief description of approach                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎨 Implementation Guidelines

When creating a new visualization, ensure you include:

  1. Header Section

    • Clear problem title
    • Subtitle with problem number or description
    • Navigation back to problem list
  2. Input Controls

    • Input field for custom data entry
    • Play/Pause button for animation
    • Step forward/backward buttons (β—„ β–Ί)
    • Speed control slider
    • Reset button to start over
    • Step counter showing progress
  3. Code Display (Left Panel)

    • Syntax-highlighted code
    • Line numbers
    • Current executing line highlighted
    • Support for multiple language tabs (C++, Java, Python)
  4. Visualization Area (Right Panel)

    • Main visual representation (bars, nodes, grid, etc.)
    • Smooth animations between states
    • Color coding:
      • Blue - Currently processing
      • Green - Completed/correct
      • Red - Comparison/error
      • Yellow/Gold - Special focus
      • Gray - Default/unprocessed
    • Clear labels and indices
  5. Data Structure Display

    • Show auxiliary arrays/stacks/queues if used
    • Display current values
    • Highlight active elements
    • Update in sync with main visualization
  6. Output Section

    • Large, clear display of final result
    • Use success color (green) for completion
    • Include units or context
  7. Explanation Panel

    • Dynamic text explaining current step
    • Show formulas or calculations
    • Update with each step
    • Keep it concise and clear
  8. Complexity Analysis

    • Time complexity with Big-O notation
    • Space complexity with Big-O notation
    • Brief explanation of why
    • Comparison with other approaches if applicable

πŸ“‹ Component Checklist

Before submitting your visualization, ensure:

  • Follows the standard layout structure
  • Includes all required sections
  • Code is properly syntax highlighted
  • Animations are smooth and not too fast/slow
  • Colors are consistent with the design system
  • Responsive design works on different screen sizes
  • Input validation handles edge cases
  • Step-by-step navigation works correctly
  • Explanation text is clear and educational
  • Complexity analysis is accurate
  • Code is well-commented
  • No console errors or warnings

πŸŽƒ Hacktoberfest

This project participates in Hacktoberfest! We encourage quality contributions during October and throughout the year.


πŸ“Έ Screenshots

Example: Trapping Rain Water Visualization

The visualization follows our standard layout with:

  • Input controls at the top
  • Code visualization on the left
  • Interactive elevation map on the right
  • Data structure displays (lmax, rmax arrays)
  • Real-time output and step explanations
  • Complexity analysis at the bottom
Trapping Rain Water Visualization

Standard layout showing all required components

Add more screenshots of your visualizations here


πŸŽ“ Learning Resources

Want to learn more about the algorithms visualized in this project?


πŸ› Known Issues

  • No known critical issues at this time
  • Report bugs via GitHub Issues

πŸ“œ License

Distributed under the MIT License. See LICENSE file for more information.


πŸ‘¨β€πŸ’» Author

Mahaveer Gurjar


πŸ™ Acknowledgments

  • Inspired by the need for better algorithm education tools
  • Thanks to all contributors who have helped improve this project
  • Built with ❀️ for the developer community

πŸ“Š Project Stats

GitHub stars GitHub forks GitHub issues GitHub pull requests


πŸ§‘β€πŸ’» Run the Project Locally (Beginner Friendly)

If you're contributing for the first time (like during Hacktoberfest πŸŽƒ), follow these simple steps to set up AlgoVisualizer locally:

# 1️⃣ Fork this repository (click 'Fork' on GitHub)
# 2️⃣ Clone your fork
git clone https://github.com/<your-username>/AlgoVisualizer.git

# 3️⃣ Navigate into the project folder
cd AlgoVisualizer

# 4️⃣ Install required dependencies
npm install

# 5️⃣ Start the local development server
npm run dev

Now open your browser and go to πŸ‘‰ http://localhost:5173

to explore the app locally!

If you find this project helpful, please consider giving it a ⭐!

Made with πŸ’» and β˜• by developers, for developers.

About

AlgoVisualizer is a web-based, interactive platform designed to help users understand complex Data Structures and Algorithms (DSA) by visualizing their step-by-step execution. Built with React and Tailwind CSS, it provides a clean, modern, and intuitive interface for learning.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 45

Languages