A dynamic and interactive web-based sorting visualizer that helps users understand various sorting algorithms. Users can generate random arrays, input their own arrays, adjust visualization speed, and observe the time and space complexity of each algorithm in action. The visualizer uses color-coded steps to enhance understanding:
- Blue: Default state
- Yellow: Being compared
- Red: Incorrect position, to be moved
- Green: Correct position
Try the Sorting Visualizer live at: Sorting Visualizer
-
Visualize popular sorting algorithms:
- Bubble Sort
- Selection Sort
- Insertion Sort
- Merge Sort
- Quick Sort
- Heap Sort
- Counting Sort
- Tim Sort
-
Generate random arrays of different sizes.
-
Input custom arrays for personalized testing.
-
Adjust the speed of the visualization for better clarity.
-
Displays Time Complexity (Best, Average, Worst) and Space Complexity.
-
Refresh functionality to restart or reset the visualization.
- HTML: Structure of the web app.
- CSS: Styling and layout.
- JavaScript: Core functionality, algorithms, and visualizations.
- Clone the repository:
git clone https://github.com/kmusadiqpasha/sorting-visualizer.git
- cd sorting-visualizer
- Open index.html in your web browser to launch the application.
- Adjust the Size of the Array using the slider.
- Set the Speed of visualization using the speed slider.
- Click Generate Random Array to create a new array or input your own array (comma seperated) and click Generate from Input.
- Choose a sorting algorithm by clicking its respective button.
- Observe the real-time visualization and complexity metrics displayed on the screen.
Here are some potential features and improvements planned for the Sorting Visualizer:
-
Additional Sorting Algorithms:
- Add more algorithms like Radix Sort, Shell Sort, and Bucket Sort for a broader comparison.
-
Algorithm Comparison Mode:
- Provide a side-by-side visualization to compare multiple algorithms simultaneously.
-
Performance Metrics Dashboard:
- Include a detailed dashboard to show real-time performance metrics such as execution time, swaps, and comparisons.
- This project is licensed under the MIT License - see the LICENSE file for details.