There are various types of sorting algorithms and it is very difficult to understand their working without visualization. Hence we decided to visualize these sorting algos in python with the help of matplotlib.animations
Pro tip :- Time complexity can also be seen through these visualizations
This repository is a demo of visualizing 8 types of Sorting Algorithms. It aims to make Sorting Algorithms easier for programmers to understand. Also, you can see the difference of Time Complexity between different sorting algorithms.
| Sorting Algorithm | AverageTime Complexity | Bad Time Complexity | Stability |
|---|---|---|---|
| Bubble Sort | O(N^2) | O(N^2) | YES |
| Insertion Sort | O(N^2) | O(N^2) | YES |
| Shell Sort | O(N^5/4) | O(N^2) | NO |
| Selection Sort | O(N^2) | O(n^2) | NO |
| Heapify Sort | O(NlogN) | O(NlogN) | NO |
| Merge Sort | O(NlogN) | O(NlogN) | YES |
| Quick Sort | O(NlogN) | O(N^2) | NO |
| Count Sort | O(N) | O(N) | YES |
- python3.x
- matplotlib
- pygame
-
Check all dependencies installed
This command can help you install all the dependent packages
pip install -r requirements.txt -
Start sorting.py
python3 sorting.pyEnter the number of elements:: choise a numberChoose algorithm:: Sorting Type. Choose one 1.Bubble 2.Insertion 3.Quick 4.Selection 5.Merge Sort 6.Heapify 7.Shell 8.Count sort
-
Start sorting.py
python3 QuickSort.pyPress “Enter” key:: to Perform Visualization.Press “R” key:: to generate new array.
Total operations = 435
Total operations = 460
Total operations = 230
Total operations = 131
another sorting algorithm visualization using pygame
Total operations = 177





