One of the main activities in algorithms and programs, whose purpose is manipulating data, is sorting. So if you write these kinds of programs-what kind of method for sorting data is best? In this article I will present some algorithms for sorting and their advantages and weaknesses.
Let’s begin with sorting techniques. There are two groups of sorting methods: inner and outer. Inner is often used when you have data to hold in operative memory, and outer sorting is used on large quantities of data located on peripherals (such as hard disks) organized in files.
Assume that we have our keys placed in an array (a, a, ... , a[n]). Of course you can use something else to store your keys, perhaps linked-list, but in this case a simple array is good. (Linked lists are slower due to sequential data reading each time.)
The first group of inner-sorting methods is termed "sorting by comparing". There are four method types:
Reconnecting methods is also used for outer–sorting.