A Sorting Algorithm Visualizer built using HTML, CSS, and JavaScript.
This project demonstrates how various sorting algorithms work by visualizing the sorting process in real-time with animated bars.
It includes dark mode, customizable bar colors, speed control, and swap count tracking.
- π¨ Beautiful UI with Light/Dark Mode toggle.
- π Sorting Algorithms Supported:
- π’ Bubble Sort
- π‘ Selection Sort
- π΅ Insertion Sort
- π£ Merge Sort
- π΄ Quick Sort
- ποΈ Adjustable animation speed.
- π¨ Customizable bar colors.
- π’ Swap counter to track operations.
- π Generate a new random array instantly.
- π± Fully responsive design.
- HTML5 β Structure
- CSS3 β Styling & Dark Mode
- JavaScript (ES6) β Sorting algorithms, animations, and interactivity
git clone https://github.com/<your-username>/sorting-visualizer.gitcd sorting-visualizerJust open the index.html file in any modern browser.Sorting Algorithms Visualized
| Algorithm | Time Complexity | Space Complexity | Stability | Visualization |
|---|---|---|---|---|
| Bubble Sort | O(nΒ²) | O(1) | β Stable | β |
| Selection Sort | O(nΒ²) | O(1) | β Unstable | β |
| Insertion Sort | O(nΒ²) | O(1) | β Stable | β |
| Merge Sort | O(n log n) | O(n) | β Stable | β |
| Quick Sort | O(n log n) | O(log n) | β Unstable | β |
-
Each bar represents an array element.
-
Bar height corresponds to the value.
-
Swaps are animated to visualize the sorting process.
Control Description
- π¨ Bar Color Picker Change the color of bars dynamically
- β± Speed Slider Adjust animation speed
- π Generate Array Create a new random dataset
- π Sorting Buttons Choose between 5 sorting algorithms
- π Dark Mode Toggle between light & dark themes
- π’ Swap Counter Shows the number of swaps performed
sorting-visualizer/
βββ index.html # Main HTML file
βββ README.md # Project documentation (Since CSS & JS are embedded in the HTML file.)
β Add Heap Sort & Counting Sort
β Add Sound effects for swaps π΅
β Deploy live demo on GitHub Pages
β Improve mobile responsiveness
Contributions, issues, and feature requests are welcome! Feel free to fork the repository and submit a pull request.
This project is licensed under the MIT License β you are free to use, modify, and distribute it.
Kinza Afzal π§ kinzaafzal07122004@gmail.com
π GitHub Profile: kinza7124
If you like this project, donβt forget to star the repository β on GitHub!