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://en.wikipedia.org/wiki/In-place_algorithm.
Types Of Sorting :
- Internal Sorting
- External Sorting
Sort Stability :
- Stable Sort
- 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 Please write comments if you find anything incorrect, or if you want to share more information about the topic discussed above