Minimizing the number of writes is useful when making writes to some huge data set is very expensive, such as with EEPROMs or Flash memory, where each write reduces the lifespan of the memory.

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.

Sources:

http://en.wikipedia.org/wiki/Cycle_sort

http://en.wikipedia.org/wiki/Selection_sort

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Find the Minimum length Unsorted Subarray, sorting which makes the complete array sorted
- Know Your Sorting Algorithm | Set 1 (Sorting Weapons used by Programming Languages)
- Know Your Sorting Algorithm | Set 2 (Introsort- C++’s Sorting Weapon)
- Sorting objects using In-Place sorting algorithm
- Find a pair of elements swapping which makes sum of two arrays same
- Replacing an element makes array elements consecutive
- Bead Sort | A Natural Sorting Algorithm
- A sorting algorithm that slightly improves on selection sort
- Print a case where the given sorting algorithm fails
- Sorting Algorithm Visualization : Merge Sort
- Sorting Algorithm Visualization : Quick Sort
- When to use each Sorting Algorithm
- Sorting algorithm visualization : Insertion Sort
- Sorting algorithm visualization : Heap Sort
- Sorting 2D Vector in C++ | Set 3 (By number of columns)
- Stability in sorting algorithms
- Lower bound for comparison based sorting algorithms
- A Pancake Sorting Problem
- External Sorting
- Cartesian Tree Sorting