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. Understand all types of sorting algorithms in data structures with detailed examples. Learn each method's unique features and use cases in this tutorial. Sorting Algorithms Time Complexity This classification provides a foundation for understanding the strengths and weaknesses of different sorting techniques. 3. Basic Sorting Algorithms (O (n²) Time Complexity) The basic sorting algorithms have a time complexity of O (n²) and are generally used for small datasets due to their inefficiency on larger inputs. These include Bubble Sort , Selection Sort , and Insertion Sort . 3. 1. Bubble Sort Concept: Repeatedly compares adjacent elements and ... Sorting algorithms are a set of instructions that take an array or list as an input and arrange the items into a particular order. Sorts are most commonly in numerical or a form of alphabetical (called lexicographical) order, and can be in ascending ...