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.
Sorting is commonly used as the introductory problem in various Computer Science classes to showcase a range of algorithmic ideas. Without loss of generality, we assume that we will sort only Integers, not necessarily distinct, in non-decreasing order in this visualization.
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.