Skip to content

pattersonrptr/sorting_algorithms_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

Sorting Algorithms in Python

This is just a demonstration of the implementation of some sorting algorithms using Python. There are implementations of sorting in Python's standard library that are much better for performance reasons. When I wrote these codes I was learning Python and I wanted to do some exercises to improve my Python skills and then since I was taking Data Structures classes in college I implemented the algorithms in Python, I already knew the most well-known sort algorithms, but I ended up getting myself excited and learning a few more as was the case with Comb, Gnome Cocktail and Shell Sort.

The following algorithms were implemented:

  • Bubble
  • Bucket
  • Cocktail
  • Comb
  • Counting
  • Gnome
  • Heap
  • Insertion
  • Selection
  • Merge
  • Quick
  • Radix
  • Shell

The program shows the execution times of each algorithm, it is possible to create a random vector of integers and test it with all the algorithms for comparison purposes. It is nice to note that the difference in execution times of each algorithm grows as you use larger vectors. Small vectors are ordered quickly by any of these algorithms with a small time difference between them, but by increasing the vector sizes, it is seen that the more advanced algorithms like Quick, Merge, Bucket, Heap and Shell go absurdly better than the others.