A sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the use of other algorithms (such as search and merge algorithms) which require input data to be in sorted lists; it is also often useful for canonicalizing data and for producing human-readable output. More formally,
The output must satisfy two conditions:
1.The output is in nondecreasing order (each element is no smaller than the previous element according to the desired total order);
2.The output is a permutation (reordering) of the input.
Sorting Types:
1 Simple sorts
1.1 Insertion sort
1.2 Selection sort
2 Efficient sorts.
2.1 Merge sort
2.2 Heapsort
2.3 Quicksort
3 Bubble sort and variants
3.1 Bubble sort
3.2 Shell sort
3.3 Comb sort
4 Distribution sort
4.1 Counting sort
4.2 Bucket sort
4.3 Radix sort