Sorting algorithms

Sorting algorithms are algorithms which are employed to sort through lists quickly. This is extremely useful because when there is a huge list of items, extra operations may slow down the computer. Not only are sorting algorithms important for analysing datasets but they have many other uses such as disk defragmentation where blocks of similar IDs must be grouped together. They can also make it easier to search through lists ( e.g. binary search )

There are many different sorting algorithms, some of which are more efficient than others. Nevertheless, it is still interesting to understand the logical process through which computers can sort through lists. My favourite sorts are the bubble sort, shuttle sort and merge sort.

The bubble sort is a series of 'passes' which is when adjacent items are compared going down the list. This is repeated till the list is sorted. For a list of n items, the number of operations is of the magnitude n2.
The shuttle sort is my favourite; I tend to use it when organising books. Similar to the insertion sort, it iterates through items and items are shuttled backwards till it's larger than its previous element. Shuttle sort is also of the order n2 operations.
The merge sort is when elements are grouped together. Groups are then merged together in the correct order till the whole list is under one group. On paper, the merge sort is quicker than both of the above with an order of n log n operations.

Below is an animation of each of the sorts compared by time with eachother. Just click the canvas.