Skip to content

Latest commit

 

History

History
87 lines (67 loc) · 3.01 KB

README.md

File metadata and controls

87 lines (67 loc) · 3.01 KB

python-sorting-algorithms

a series of algorithms in python please feel free to add and edit, I made this to improve and practice my programming and to learn new sorting techniques, and to have fun with esoteric sorts.

These have been added:

  • Bubble sort
  • Counting sort
  • Quick sort
  • Radix sort
  • Insertion sort
  • Selection sort
  • merge sort
  • Heap sort
  • Pancake sort
  • Pigeonhole sort
  • Bucket sort

esoteric sorts:

  • Bogo sort
  • Intelligent design sort
  • Miracle sort/solarbit flip sort
  • Stalin sort
  • Threatening Sort DO NOT EVEN THINK ABOUT USING THIS
  • Sleep sort

my own algorithms:

  • Sassy sort (tells you to sort it your own damn self)
  • Meme sort (sort based on proximity to the numbers 69 and 420)

These will be added:

  • Tim sort
  • LSD radix
  • No extra space radix
  • Cocktail sort
  • Sorting network

esoteric sorts:

  • Sudo bogo sort
  • Bozo sort
  • Jingle sort
  • Bogobogo sort
  • Spaghetti sort
  • Stooge
  • Rolling stone sort(physics engine required)
  • Slow sort
  • Worst sort
  • Linus sort

my own algorithms:

  • lls{low level sort} sorts based on -1 to each value and ordering base on which reaches 0 first (only positive ints)
  • Reddit sort (post it on Reddit and take the top reply as fact)
  • combo sort (sorts with 5 algorithms to make sure its correct)
  • 5 stages of grief sort

notes

Each algorithm is in a function which takes only an unsorted array as a parameter returns the sorted array
There are notes before each algorithm explaining it.

  • n = number of elements to sort
  • d = number of digits in the largest element
  • r = range of elements (largest - smallest)
  • k = size of key (in this case the size of the digit)

the best, average and worst shows the trend of how each algorithm will perform when increasing these values.
I will continue improving this and adding new algorithms

Some algorithms use comparisons which allows them to be used in more situations while others use specific properties of their character set (integers for this program). Due to this sometimes the algorithm with the best big O is not always the best algorithm. to further explain this, likely the bets big O of all algorithms is sleep sort with O(k) but sleep sort is difficult to implement in a way that it will reliably sort and will often run slower than other algorithms.

This program is a collection of both standard and obscure algorithms, for an amazing demonstration of LOTS of the more common algorithms, please look into website http://panthema.net/2013/sound-of-sorting/