Classification of Sorting Algorithms Last Updated : 23 Nov, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report Sorting is an algorithm which arranges the elements of a given list in a particular order [ascending or descending]. Sorting algorithms are categorized on the following basis - By number of comparisons :Comparison-based sorting algorithms check the elements of the list by key comparison operation and need at least O(n log n) comparisons for most inputs. In this method, algorithms are classified based on the number of comparisons. For comparison based sorting algorithms, best case behavior is O(n log n) and worst case behavior is O(n2). For example - Quick Sort, Bubble Sort ,Insertion Sort etc. By Number of Swaps :In this method, sorting algorithms are categorized by the number of swaps (interchanging of position of to numbers, also called inversion). By Memory Usage :Some sorting algorithms are “in place” and they need O(1) or O(log n) memory to create auxiliary locations for sorting the data temporarily. By Recursion :Sorting algorithms are either recursive (for example - quick sort) or non-recursive (for example - selection sort, and insertion sort), and there are some algorithms which use both (for example - merge sort). By Stability :Sorting algorithm is stable if two elements with equal values appear in the same order in output as it was in the input. The stability of a sorting algorithm can be checked with how it treats equal elements. Stable algorithms preserve the relative order of equal elements, while unstable sorting algorithms don’t. In other words, stable sorting maintains the position of two equals elements similar to one another. For example - Insertion Sort, Bubble Sort , and Radix Sort. By Adaptability :In a few sorting algorithms, the complexity changes based on pre-sorted input i.e. pre-sorted array of the input affects the running time. The algorithms that take this adaptability into account are known to be adaptive algorithms. For example - Quick sort is an adaptive sorting algorithm because the time complexity of Quick sort depends on the initial input sequence. If input is already sorted then time complexity becomes O(n^2) and if input sequence is not sorted then time complexity becomes O(n logn).Some adaptive sorting algorithms are : Bubble Sort, Insertion Sort and Quick Sort. On the other hand some non-adaptive sorting algorithms are : Selection Sort, Merge Sort, and Heap Sort. Internal Sorting :Sorting algorithms that use main memory exclusively during the sort are called internal sorting algorithms. This kind of algorithm assumes high-speed random access to all memory. Some of the common algorithms that use this sorting feature are : Bubble Sort, Insertion Sort., and Quick Sort. External Sorting :Sorting algorithms that use external memory, during the sorting come under this category. They are comparatively slower than internal sorting algorithms. For example merge sort algorithm. It sorts chunks that each fit in RAM, then merges the sorted chunks together. Comment More infoAdvertise with us Next Article Classification of Sorting Algorithms I imsushant12 Follow Improve Article Tags : Sorting GATE CS DSA Practice Tags : Sorting Similar Reads Classification of Algorithms with Examples There are many ways of classifying algorithms and a few of them are shown below: Implementation MethodDesign MethodOther Classifications Classification by Implementation Method: 1. Recursion or Iteration A recursive algorithm is one that calls itself repeatedly until a base condition is satisfied. I 4 min read Time Complexities of all Sorting Algorithms The efficiency of an algorithm depends on two parameters:Time ComplexityAuxiliary SpaceBoth are calculated as the function of input size(n). One important thing here is that despite these parameters, the efficiency of an algorithm also depends upon the nature and size of the input. Time Complexity:T 2 min read Sorting Algorithms 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 exist different sorting algorithms for differ 3 min read The Slowest Sorting Algorithms A Sorting Algorithm is used to rearrange a given array or list elements according to a comparison operator on the elements. The comparison operator is used to decide the new order of the element in the respective data structure. But Below is some of the slowest sorting algorithms: Stooge Sort: A Sto 15+ min read Hybrid Sorting Algorithms Hybrid sorting algorithms combine two or more standard sorting techniques to optimize performance. For example, Insertion sort works well for small inputs and Quick Sort for large and IntroSort (A Hybrid Sorting Algorithm) uses these properties for using Quick Sort while the input is large and switc 2 min read Like