Welcome to the Sorting Algorithm Visualizer, an interactive Python application built using Pygame. This project is designed to help users understand sorting algorithms through real-time visualizations. It features two fundamental sorting algorithms: Bubble Sort and Insertion Sort, both visualized step-by-step with a dynamic and colorful bar graph interface.
Check out the live demo of the visualizer in action!
Watch the Video on Vimeo
This visualizer demonstrates sorting processes with vibrant, real-time animations. Users can interact with the visualizer by selecting different sorting algorithms, adjusting sorting directions (ascending/descending), and resetting the array for a fresh start.
- Real-time visualization of sorting algorithms
- Interactive controls for a customizable sorting experience
- Modern UI with gradient color schemes and clear instructions
- Educational tool for students, developers, and coding enthusiasts
- Language: Python
- Library: Pygame
- Fonts: Poppins and FiraCode for a clean, modern look
Check out the live demo of the visualizer in action!
Watch the Video on Vimeo
| Key | Action |
|---|---|
R |
Reset the array |
SPACE |
Start sorting |
A |
Sort in ascending order |
D |
Sort in descending order |
I |
Switch to Insertion Sort |
B |
Switch to Bubble Sort |
| Element | Color | RGB Value | Description |
|---|---|---|---|
| Background | Dark Navy | (30, 30, 30) |
Darker background for better contrast |
| Bars (Gradient) | Cool Grey Shades | (80, 80, 80), (130, 130, 130), (180, 180, 180) |
Gradient from dark to light grey |
| Text | Light Blue | (0, 191, 255) |
For instructions and algorithm name |
| Comparison | Red | (255, 69, 58) |
Bars being compared during sorting |
| Sorted | Green | (0, 255, 127) |
Bars that are fully sorted |
This project helps users understand:
- How sorting algorithms work step-by-step
- The difference between Bubble Sort and Insertion Sort
- The importance of visual representation in understanding algorithms
- How to use Pygame for creating interactive visualizations
- Clone the Repository:
git clone https://github.com/your-username/sorting-visualizer.git cd sorting-visualizer - Install Dependencies: Make sure you have Python and Pygame installed:
pip install pygame
- Run the Application:
python main.py
- Adding more sorting algorithms (Quick Sort, Merge Sort, etc.)
- Enhancing the UI with additional controls and themes
- Optimizing the visualizer for better performance
For any inquiries or feedback, please reach out:
- Name: Kenny Garcia
- GitHub: github.com/bebopkenny
- Portfolio: kennygarcia.net
- Email: kennygarcia15@yahoo.com
This project is licensed under the MIT License. See the LICENSE file for more details.


