A beautiful, interactive web application that visualizes various sorting algorithms in real-time. This project helps in understanding how different sorting algorithms work through visual representation.
-
Multiple Sorting Algorithms:
- Quick Sort
- Merge Sort
- Heap Sort
- Bubble Sort
-
Interactive Controls:
- Adjustable array size (10-100 elements)
- Variable sorting speed
- Generate new random arrays
- Real-time visualization
-
Performance Metrics:
- Time elapsed
- Number of comparisons
- Array access count
- JavaScript (ES6+)
- HTML5
- CSS3
- No external dependencies!
- Uses the divide-and-conquer strategy
- Average time complexity: O(n log n)
- Partition-based sorting
- Divide-and-conquer algorithm
- Stable sorting algorithm
- Time complexity: O(n log n)
- Binary heap data structure
- In-place sorting algorithm
- Time complexity: O(n log n)
- Simple comparison-based algorithm
- Time complexity: O(n²)
- Great for educational purposes
-
Clone the repository:
git clone https://github.com/yourusername/sorting-visualizer.git
-
Navigate to the project directory:
cd sorting-visualizer -
Open the project:
- Simply open
index.htmlin your web browser - No build process or dependencies required!
- Simply open
-
Generate New Array:
- Click the "Generate New Array" button to create a new random array
- Use the array size slider to adjust the number of elements
-
Choose Algorithm:
- Select your desired sorting algorithm from the dropdown menu
-
Adjust Speed:
- Use the speed slider to control the visualization speed
- Move right for faster animation, left for slower
-
Start Sorting:
- Click "Start Sorting" to begin the visualization
- Watch the bars rearrange in real-time!
- Blue bars: Unsorted elements
- Yellow bars: Elements being compared/swapped
- Green bars: Sorted elements
Contributions are welcome! Here are some ways you can contribute:
- Add new sorting algorithms
- Improve visualization effects
- Add additional performance metrics
- Fix bugs or improve performance
Please feel free to submit issues and pull requests.
- Inspired by various sorting algorithm visualizers
- Built with modern JavaScript features
- Designed with a focus on educational value
⭐️ If you found this project helpful, please give it a star!