Let us say we want to find a word in a dictionary. But there is an exception that the words are not sorted in alphabetical order.
This would require us to scan each and every page of the dictionary, which would take huge effort and time. This is the reason why sorting objects are important. It tremendously helps in searching for items quickly.
There are various ways in which we can sort items. In Computer Science, we make use of various algorithms to sort objects. These algorithms are also known as sorting algorithms. Let’s see what they mean.
A Sorting Algorithm is used to rearrange a given array or list elements according to a comparison operator on the elements. The comparison operator is used to decide the new order of elements in the respective data structure.
For example: The below list of characters is sorted in increasing order of their ASCII values. That is, the character with lesser ASCII value will be placed first than the character with higher ASCII value.
"computerscience" ----> "ccceeeimnoprstu"
In this series of Sorting Algorithms, we will take a look on the various sorting algorithms used in Computer Science, how they work, and what are their efficiencies and limits.