Open In App

Sorting Algorithms

Last Updated : 14 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

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 different different types of inputs, for example a binary array, a character array, an array with a large range of values or an array with many duplicates or a small vs large array.
  • The algorithms may also differ according to output requirements. For example, stable sorting (or maintains original order of equal elements) or not stable.
  • Sorting is provided in library implementation of most of the programming languages. These sorting functions typically are general purpose functions with flexibility of providing the expected sorting order (increasing or decreasing or by a specific key in case of objects).

Basics of Sorting Algorithms:

Sorting Algorithms:

Comparison Based : Selection Sort, Bubble Sort, Insertion Sort, Merge Sort, Quick Sort, Heap Sort, Cycle Sort, 3-way Merge Sort
Non Comparison Based : Counting Sort, Radix Sort, Bucket Sort, TimSort, Comb Sort, Pigeonhole Sort
Hybrid Sorting Algorithms : IntroSort, Tim Sort

Library Implementations:

Easy Problems on Sorting:

Medium Problems on Sorting:

Hard Problems on Sorting:

Quick Links :

Recommended:


Article Tags :
Practice Tags :

Similar Reads