This project is a sorting visualizer built using Pygame and Pygame Menu. It allows users to interactively choose and visualize various sorting algorithms through a graphical interface. The visualizer displays sorting operations in real-time, making it easier to understand and compare different sorting methods.
- Interactive Menu: Select from a variety of sorting algorithms and adjust sorting speed and the number of items to be sorted.
- Real-Time Visualization: Watch how different sorting algorithms process and sort data visually.
-
Install Dependencies: Ensure you have
pygameandpygame-menuinstalled. You can install them via pip:pip install pygame==2.5.2 pygame-menu==4.4.3
-
Run the Program: Execute the main script to start the visualizer:
python main.py
-
Using the Menu:
- Sorting Algorithm: Choose from available sorting algorithms (e.g., Bubble Sort, Quick Sort).
- Sorting Speed: Adjust the speed of sorting (lower values are faster).
- Amount of Items: Set the number of items to sort.
-
Start Sorting: Click the "Start Sorting" button to see the selected sorting algorithm in action.
- Bubble Sort: A simple comparison-based sorting algorithm.
- Insertion Sort: Builds the sorted array one item at a time.
- Selection Sort: Selects the smallest element and places it in the correct position.
- Quick Sort: Uses a divide-and-conquer approach to sort data efficiently.
- Merge Sort: Divides the array into halves, sorts each half, and merges them.