In this post, we will talk about different **Classification of Sorting Algorithms.**

**Classification of Sorting Algorithms:**

**By Number of Comparisons**

In this method, Sorting algorithms are usually 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). Comparison-based sorting algorithms evaluate the elements of the list by key comparison operation and need at least O(n log n) comparisons for most inputs.

**By Number of Swaps**

In this method, sorting algorithms are categorized by the number of swaps.

**By Memory Usage**

Some sorting algorithms are ”in place” and they need O(1) or O(n log n) memory to create auxiliary locations for sorting the data temporarily.

**By Recursion**

Sorting algorithms are either recursive(Quicksort) or non-recursive(selection Sort and Insertion sort) and there are some algorithms that use both(merge sort)**.**

**By Stability**

Sorting algorithms is stable if for all the indices i and j such that the key A[i] equals key A[j], If record R[i] precedes record R[j] in the original input. Record R[i] precedes record R[j] in the sorted list. Few sorting algorithms maintain the relative order of elements with equal keys(equivalent elements retain their relative positions even after sorting**)**

**By Adaptability**

With a few sorting algorithms the complexity changes based on pre-sortedness (quicksort). pre-sortedness of the input affects the running time. Algorithms that take this into account are usually known to be adaptive.

**Other Classifications:**

**Internal Sort**

Sorting algorithms that use the main memory exclusively during the sorting are called internal sorting algorithms. This kind of algorithm usually assumes high-speed random access to all memory.

**External Sort**

Sorting algorithms which use external memory, such as disk or tape, during the Sort comes under this category

**You May Also Like:**

What is Searching ?Why do we need Searching? Explain different Types of Searching ?

Java program for linear search using the Iterative Approach

Java program for linear search using Recursive Approach

Java program for Binary search using Iterative Approach

Java program for binary search using the Recursive Approach

Interpolation Search Program in Java

That’s all about **Classification of Sorting Algorithms**

If you have any feedback or suggestion please feel free to drop in below comment box.