Among the sorting algorithms that we generally study in our data structure and algorithm courses, Selection Sort makes least number of writes (it makes O(n) swaps). But, Cycle Sort almost always makes less number of writes compared to Selection Sort. In Cycle Sort, each value is either written zero times, if it’s already in its correct position, or written one time to its correct position. This matches the minimal number of overwrites required for a completed in-place sort.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Cycle Sort
- Minimum number of swaps required to sort an array
- Where is Heap Sort used practically?
- Why Quick Sort preferred for Arrays and Merge Sort for Linked Lists?
- Selection Sort
- Insertion Sort
- Iterative Quick Sort
- Sort a nearly sorted (or K sorted) array
- Lower bound for comparison based sorting algorithms
- Stability in sorting algorithms
- When does the worst case of Quicksort occur?
- Find the Minimum length Unsorted Subarray, sorting which makes the complete array sorted
- Sort an array of 0s, 1s and 2s
- Merge Sort for Linked Lists