Some Discourse on Sorting

Written by Raza on. Posted in C++


Sorting means to arrange the given list of data in any particular form or order. Generally sorting is done on the basis of numerical order and alphabetical or lexicographical order. Here we shall be discussing only the numerical order. In Computer Science, sorting has always been given special attention and interest because it is a vital part of many other fundamental processes. Still now, research is going on to improve the sorting techniques and numerous algorithms have been presented for this purpose. Some basic ones which are commonly used are selection sort, bubble sort, insertion sort, merge sort, shell sort, quick sort, etc.  

A good sorting algorithm should at least have the following characteristics.

  1. It should be simple in nature, easy to understand and implement. Not very complex.
  2. It should utilize minimum of the system resources and memory.
  3. It should follow a fixed set of instructions rather than sorting by hit and trial method, like Bogosort. (Stupid Sort)
  4. It should consider well the best, worst and the average cases.

There are many scenarios for an Algorithm. Best or Ideal case of an algorithm means when the list is already sorted. Worst case means when the list is completely disarrayed, for example when we want to sort in ascending order and the list is present in descending order, so it’s the worst case. Average case means the normal conditions when there is some disorder as well some ordering in the list.

I shall try to elaborate some of the popular sorting Algorithms one by one to you in the upcoming posts. So stay tuned!!!

Tags: , , ,