SORTING What exactly does sorting mean? Sorting means to arrange the data in a certain order. There are many algorithms designed to serve this purpose. It is considered to be defacto problem for the study of algorithms. Let us see where exactly we can see the implementation of sorting. Most of you have been googling for various stuff. Have you ever noticed the results that appear immediately in the drop down box of the google search toolbar when you hit any key on your keyboard. Yeah! That's sorting.. google sorts various results on its server for you. So basically what we have is
: a sequence of n numbers (a1,a2,a3,......an)OUTPUT:
A permutation of the numbers such that (a1 < a2 < a3 .... < an)
There are two types of sorting: internal and external sorting.
• INTERNAL SORTING: If all the data to be stored can be accommodated at a time in memory then internal sorting methods are used. Various methods are discussed later in these notes. • External sorting
: When the data to be stored is so large that some of the data has to be imported from auxiliary memory (hard disk,flash drive etc...), then external sorting methods are used. This is done by calling appropriate function at the time of sorting.