Posts /

Sorting Algorithms: Revisited

1 min read ●
Twitter Facebook Google+
07 Sep 2017


In the world full of data, maintaining the data is a one hectic task. To be able to get the meaning out of this data and search it, data needs to be sorted. The problem to maintain the data is hard to tackle and requires serious solution. Algorithms play an important role in solving such problems.
In order to facilitate the students new to Algorithms, I started 100 Algorithms in Python series. Till now, I have posted about 6 algorithms out of which five are sorting algorithms. This post is about those algorithms, as I will pivot to some other interesting algorithms. The ones I have post in my blog are:

Which one to use?

Insertion and Insertion Sort are pretty straightforward. They iterate over all the items multiple times and moving some items back and forth to get them in order. For this reason, their performance is O( n2 ), where n is the number of items to sort.
With O( n log(n) ) complexity, Merge and Quick Sort are clearly the winners here. They both are relatively faster than their siblings. This is all about performance, but I still like Quick Sort more. The reason is that it is easier to implement as compared to its competitor, Merge Sort. With recursion, Merge Sort becomes complex to understand.
I believe Pigeonhole Sort is an overkill with its tricky time and space complexity. Although it gives a hint how mathematical principles can be used in such a way, a better similar solution is still at large.

Featured Image: Pixabay

You may also like...

Twitter Facebook Google+