https://github.com/archerhume/sortingalgorithms
📊 A collection of sorting algorithms written in Python. An educational tool used for demonstrations of said algorithms.
https://github.com/archerhume/sortingalgorithms
algorithms data-science python sorting-algorithms
Last synced: 10 months ago
JSON representation
📊 A collection of sorting algorithms written in Python. An educational tool used for demonstrations of said algorithms.
- Host: GitHub
- URL: https://github.com/archerhume/sortingalgorithms
- Owner: ArcherHume
- Created: 2022-03-14T11:33:47.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-04T04:37:16.000Z (almost 2 years ago)
- Last Synced: 2025-07-30T00:04:13.617Z (12 months ago)
- Topics: algorithms, data-science, python, sorting-algorithms
- Language: Python
- Homepage:
- Size: 27.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# sortingAlgorithms
A collection of sorting algorithms written in Python. An educational tool used for demonstrations of said algorithms.

## Current Algorithms
- [Bubble Sort](https://en.wikipedia.org/wiki/Bubble_sort)
- [Selection Sort](https://en.wikipedia.org/wiki/Selection_sort)
- [Selection Sort (Recursion)](https://en.wikipedia.org/wiki/Selection_sort)
- [Quick Sort](https://en.wikipedia.org/wiki/Quicksort)
- [Insertion Sort](https://en.wikipedia.org/wiki/Insertion_sort)
- [Shell sort](https://en.wikipedia.org/wiki/Shellsort)
- [Comb Sort](https://en.wikipedia.org/wiki/Comb_sort)
## Quick Start
- Clone Repository:
```
git clone https://github.com/ArcherHume/sortingAlgorithms.git
cd sortingAlgorithms
```
- Install Dependencies:
```
pip install -r requirements.txt
```
- Run Script: [Usage](#usage)
## Usage
```
USAGE:
python main.py -t [algorithm]
Flags:
-t [algorithm] (Required): The algorithm you would like to run.
Choose from: selection, selection_recursive, bubble, quick_sort, insertion, shell, comb.
-l [length] (Optional): The length of the array to be sorted. Defaults to 5000.
-r [repeats] (Optional): The number of times to repeat the algorithm. Defaults to 3.
-d [delay] (Optional): The delay between each step of the algorithm, used to watch each individual step. Defaults to 0.
-width [width] (Optional): The width of the screen. Defaults to 800.
-height [height] (Optional): The height of the screen. Defaults to 600.
-h (Optional): Prints this message.
-debug (Optional): Enables debug mode.
Example: python main.py -t selection -l 10000 -r 6
```
## How to add a new algorithm
- Open the `modules/sorting_algorithms.py` file.
- Create a function with a lowercase, underscore-separated name. Add the positional arguments `array` then `delay`.
- Example: `def selection_sort(sorting_array, delay)`
- Any modifications/sorting done on the array will be reflected on screen.