Sorting Algorithm
A sorting algorithm is an algorithm which puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Efficient sorting is significant for optimizing the use of other algorithms (like search and merge algorithms) which require input data to be in sorted lists; it is also often helpful for canonicalizing data and for producing human-readable output. More formally, the output have to satisfy two conditions:
1.The output is in non-decreasing order (every element is no smaller than the previous element as per to the desired total order);
2.The output is a permutation (reordering) of the input.
Because the dawn of computing, the sorting problem has attracted a great deal of research, perhaps due to the complexity of solving it efficiently in spite of its simple, familiar statement. For instance, bubble sort .Sorting algorithms are prevalent in introductory computer science classes, in which the abundance of algorithms for the problem provides a gentle introduction to a range of core algorithm concepts, such as big O notation, divide and conquer algorithms, data structures, randomized algorithms, time-space tradeoffs, best, worst and average case analysis, and upper and lower bounds.