A place for me to learn about sorting algorithms.
- Install python on your machine.
- Install pygame by running this command:
pip install pygame
. - Navigate to the folder at which
main.py
is located. - In your terminal run
python main.py <sortingAlgorithm>
To increase the number of elements in the array press the ↑.
To decrease the number of elements in the array press the ↓.
To increase the sorting speed press the →.
to decrease the sorting speed press the ←.
Counting Sort is a good algorithm for lists with small positive integer
Speed: O(n+k)
n is number of elements in the array.
k is range of possible numbers in the array.
Bubble Sort a simple inefficient sorting algorithms. Works with any float or integer
Speed: Speed: O(n²)
n is number of elements in the array.
Quick Sort is a divide and conquer sorting algorithm.
Speed: O(n log n)
n is number of elements in the array.
Merge Sort is a divide and conquer sorting algorithm.
Speed: O(n log n)
n is number of elements in the array.
Comb Sort is an imporvement on Bubble Sort.
Speed: O(n² / 2p)
n is number of elements in the array.
p is number of increments.
Shell Sort is an in place compirason sort.
Speed: Worst: O(n²)
Best: O(n log n)
n is number of elements in the array.
Selection Sort is an in place comparison sorting algorithms.
Speed: O(n²)
n is number of elements in the array
Cocktail Sort is a variation of Bubble sort.
Speed: O(n²)
n is number of elements in the array
Gnome Sort (dubbed stupid sort) is a sorting algorithm originally proposed by Iranian computer scientist Hamid Sarbazi-Azad.
Speed: O(n²)
n is number of elements in the array
Stooge Sort is very slow recusrive sorting algorithm. Speed: O(n2.709) n is number of elements in the array
Bogo Sort is made as a joke. It works by shuffling the list until it is sorted.
Speed: O((n + 1)!)
n is number of elements in the array.