A Sorting Algorithm is used to rearrange a given array or list of elements in an order. For example, a given array [10, 20, 5, 2] becomes [2, 5, 10, 20] after sorting in increasing order and becomes [20, 10, 5, 2] after sorting in decreasing order.
There are many different sorting algorithms, each has its own advantages and limitations. Sorting is commonly used as the introductory problem in various Computer Science classes to showcase a range of algorithmic ideas.
A sorting algorithm is used to arrange elements of an array/list in a specific order. In this article, you will learn what sorting algorithm is and different sorting algorithms.
Animation, code, analysis, and discussion of 8 sorting algorithms on 4 initial conditions.