An interactive web application for visualizing sorting and searching algorithms in real-time. Built with React, this educational tool helps users understand how different algorithms work through dynamic animations and step-by-step visualizations.
- Breadth-First Search (BFS) - Explores paths level by level
- Depth-First Search (DFS) - Explores paths as far as possible before backtracking
- Customizable grid size (5-50)
- Toggle obstacles on/off
- Real-time path visualization with color coding:
- 🟢 Green: Start point
- 🔴 Red: End point
- 🟡 Yellow: Visited cells
- 🟩 Light Green: Final path
- ⬛ Black: Obstacles
- Quick Sort - Divide-and-conquer with O(n log n) average complexity
- Merge Sort - Consistent O(n log n) performance
- Insertion Sort - Efficient for small datasets
- Selection Sort - Simple but slower O(n²) approach
- Customizable array size (10-200)
- Adjustable value range
- Live statistics (comparisons and swaps)
- Real-time bar visualization with color feedback:
- 🔵 Blue: Default/unsorted
- 🟠 Orange: Currently comparing
- 🔴 Red: Recently swapped
- 🟢 Green: Sorted elements
- Beautiful gradient UI with modern navigation cards
- SVG visualizations for each algorithm category
- Quick access to all features
- Responsive design for all screen sizes
- Frontend: React 19.2.0
- Routing: React Router DOM 7.10.0
- Styling: CSS3 with animations
- Testing: Jest & React Testing Library
- Node.js (v14 or higher)
- npm or yarn
# Clone the repository
git clone <repository-url>
cd alg-app
# Install dependencies
npm installnpm startRuns the app in development mode. Open http://localhost:3000 to view it in your browser. The page reloads automatically when you make changes.
npm run buildBuilds the app for production to the build folder.
npm testLaunches the test runner in interactive watch mode.
src/
├── components/
│ ├── Header/ # Navigation header
│ ├── Home.js # Home page with navigation cards
│ ├── Search/ # Search algorithm visualizer
│ ├── Sort/ # Sort algorithm visualizer
│ └── Footer/ # Footer component
├── App.js # Main app with routing
├── App.css # Global styles
└── index.js # React entry point
- Home Page: Click on either "Search Algorithms" or "Sorting Algorithms" card
- Search Page:
- Set grid size and toggle obstacles
- Click "Generate Grid" to create random start/end points
- Select BFS or DFS from dropdown
- Click "Start Search" to visualize the algorithm
- Sort Page:
- Set array size and value range
- Click "Generate Array" to create random numbers
- Select a sorting algorithm
- Click "Start Sort" to watch the visualization
- For larger arrays (150+), use Quick Sort or Merge Sort for faster execution
- Use smaller grids for Search (10-20) to see finer detail in pathfinding
- Each visualization updates at controlled intervals for optimal performance
This visualizer is perfect for:
- Computer Science students learning algorithm fundamentals
- Interview preparation
- Understanding algorithm complexity
- Comparing algorithm efficiency visually
- Additional sorting algorithms (Heap Sort, Bubble Sort)
- Advanced search algorithms (A*, Dijkstra)
- Step-by-step replay functionality
- Speed adjustment slider
- Algorithm complexity analysis panel
- Code snippet display
This project is open source and available under the MIT License.
Contributions are welcome! Feel free to submit pull requests or issues.