An interactive visualization tool for algorithms built with D3.js. This project provides a visual representation of sorting algorithms, starting with Bubble Sort, with the architecture designed to easily add more algorithms in the future.
- Interactive visualization of Bubble Sort algorithm
- Real-time animation of sorting process
- Adjustable array size (5-50 elements)
- Customizable animation speed
- Play/Pause/Step controls
- Random array generation
- Responsive design that adapts to window size
- Smooth animations using D3.js transitions
- Modular code structure for easy algorithm additions
- State management for visualization control
- Event-driven architecture
- Frontend:
- HTML5
- CSS3
- JavaScript (ES6+)
- D3.js v7 (Data Visualization Library)
algorithm-visualizer/
├── index.html # Main HTML file
├── styles.css # Styling
├── visualizer.js # Core visualization logic
└── README.md # Documentation
- Manages the visualization state
- Handles user interactions
- Controls the sorting process
- Updates the visual representation
- Dynamic bar height representation
- Smooth transitions between states
- Responsive layout
- Interactive controls
-
Clone the Repository
git clone https://github.com/yourusername/algorithm-visualizer.git cd algorithm-visualizer -
Run the Project
- Open
index.htmlin a modern web browser - No build process required - runs directly in the browser
- Open
-
Using the Visualizer
- Adjust array size using the slider (5-50 elements)
- Set animation speed (1-10)
- Click "Generate New Array" to create a new random array
- Use "Start" to begin sorting
- "Pause" to stop the current operation
- "Step" for step-by-step visualization
- Quick Sort
- Merge Sort
- Heap Sort
- Insertion Sort
- Selection Sort
- Color coding for compared/swapped elements
- Comparison counter
- Time complexity display
- Multiple algorithm comparison view
- Custom array input
- Save/load array states
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a new branch (
git checkout -b feature/amazing-feature) - Make your changes
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow the existing code style
- Add comments for complex logic
- Update documentation for new features
- Write clean, maintainable code
This project is open source and available under the MIT License.
- Varshith Reddy.
- D3.js community for the amazing visualization library
- Contributors and users of the project