Open In App

Sorting Terminology

Improve
Improve
Like Article
Like
Save
Share
Report

What is in-place sorting? An in-place sorting algorithm uses constant space for producing the output (modifies the given array only). It sorts the list only by modifying the order of the elements within the list. For example, Insertion Sort and Selection Sorts are in-place sorting algorithms as they do not use any additional space for sorting the list and a typical implementation of Merge Sort is not in-place, also the implementation for counting sort is not an in-place sorting algorithm. so the auxiliary space complexity of non-in-place sorting algorithms is increased by O(N) where N is the number of elements on which sorting has to be applied while for in-place algorithms it does not increase. To be more clear please try the below link: https://www.geeksforgeeks.org/in-place-algorithm/

Types Of Sorting :

  1. Internal Sorting
  2. External Sorting 

Sort Stability :

  1. Stable Sort
  2. Unstable Sort

 Internal Sorting :

  • When all data is placed in the main memory or internal memory then sorting is called internal sorting.
  • In internal sorting, the problem cannot take input beyond its size.
  • Example: heap sort, bubble sort, selection sort, quick sort, shell sort, insertion sort.

External Sorting :

  • When all data that needs to be sorted cannot be placed in memory at a time, the sorting is called external sorting.            External Sorting is used for the massive amount of data. 
  •  Merge Sort and its variations are typically used for external sorting. 
  •  Some external storage like hard disks and CDs are used for external sorting.
  • Example: Merge sort, Tag sort, Polyphase sort, Four tape sort, External radix sort, Internal merge sort, etc.

 What is stable sorting?

  •  When two same data appear in the same order in sorted data without changing their position is called stable sort.
  •  Example: merge sort, insertion sort, bubble sort.

 What is Unstable sorting?

  •   When two same data appear in the different order in sorted data it is called unstable sort.
  •   Example: quick sort, heap sort, shell sort.

 See Stable Sorting Algorithms


Last Updated : 11 Mar, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads