An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          




Sorting-Algorithms-Visualizer

![Repo Size](https://img.shields.io/github/repo-size/Kacper0199/Sorting-Algorithms-Visualizer?color=green)
![Repo Elements](https://img.shields.io/github/directory-file-count/Kacper0199/Sorting-Algorithms-Visualizer?color=orange)
![Version](https://img.shields.io/pypi/pyversions/pygame)
![Last Commit](https://img.shields.io/github/last-commit/Kacper0199/Sorting-Algorithms-Visualizer?color=purple)
![Repo Language](https://img.shields.io/github/languages/top/Kacper0199/Sorting-Algorithms-Visualizer?color=ff69b4)

---

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!**