https://github.com/kacper0199/sorting-algorithms-visualizer
The purpose of this project is to visualize some fundamental sorting algorithms using simple functions and python module pygame.
https://github.com/kacper0199/sorting-algorithms-visualizer
data-structures pygame python sorting-algorithms visualization
Last synced: about 1 year ago
JSON representation
The purpose of this project is to visualize some fundamental sorting algorithms using simple functions and python module pygame.
- Host: GitHub
- URL: https://github.com/kacper0199/sorting-algorithms-visualizer
- Owner: Kacper0199
- Created: 2022-08-02T21:28:15.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-03T18:45:39.000Z (over 3 years ago)
- Last Synced: 2025-01-30T07:22:25.134Z (about 1 year ago)
- Topics: data-structures, pygame, python, sorting-algorithms, visualization
- Language: Python
- Homepage:
- Size: 52.9 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
Sorting-Algorithms-Visualizer





---
The purpose of this project is to visualize some fundamental sorting algorithms using simple functions and python module pygame.
---
- [1. Algorithms Preview](#1-algorithms-preview)
- [2. Installation](#2-installation)
- [3. Get Started](#3-get-started)
- [4. Contributing](#4-contributing)
## 1. Algorithms Preview
|Visualization|Algorithm|Best Time Complexity|Avg Time Complexity|Worst Time Complexity|
|:------------------------------------------------------------------------------------------------------------------------------------------------------:|:---:|:---:|:---:|:---:|
|
| Selection sort |$$n^{2}$$|$$n^{2}$$|$$n^{2}$$|
|
| Insertion sort |$$n$$|$$n^{2}$$|$$n^{2}$$|
|
| Bubble sort |$$n$$|$$n^{2}$$|$$n^{2}$$|
|
| Cocktail sort |$$n$$|$$n^{2}$$|$$n^{2}$$|
|
| Shell sort |$$nlogn$$|$$n^{4/3}$$|$$n^{3/2}$$|
|
| Quick sort |$$nlogn$$|$$nlogn$$|$$n^{2}$$|
|
| Merge sort |$$nlogn$$|$$nlogn$$|$$nlogn$$|
|
| Heap sort |$$nlogn$$|$$nlogn$$|$$nlogn$$|
|
| Radix sort |$$n$$|$$n\frac{k}{d}$$|$$n\frac{k}{d}$$|
## 2. Installation
Copy the repository by forking and then downloading it using:
```bash
git clone https://github.com//Sorting-Algorithms-Visualizer
```
Install requirements use:
```bash
cd Sorting-Algorithms-Visualizer
pip install -r requirements.txt
```
Run App:
```bash
cd Sorting-Algorithms-Visualizer
python3 main.py
```
## 3. Get Started
Running **_main.py_** you can sort array (in ascending order) represented by bars.
- Change number of elements in array by pressing left/right arrow keys:
→ (increase size of array - up to 300 elements)
← (decrease size of array - up to 10 elements)
- Select sorting algorithm by pressing:
1 : Selection sort
2 : Insertion sort
3 : Bubble sort
4 : Cocktail sort
5 : Shell sort
6 : Quick sort
7 : Merge sort
8 : Heap sort
9 : Radix sort
- Press Enter to start sorting
- To shuffle and create new array hit Space
## 4. Contributing
Feel free to contribute if you want to implement other sorting algorithms in **_algorithms.py_** or create better visualizer. **Please be sure to checkout [CONTRIBUTING](https://github.com/Kacper0199/Sorting-Algorithms-Visualizer/blob/main/CONTRIBUTING.md) if you want to help develop this project!**