A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/dsa/which-sorting-algorithm-makes-minimum-number-of-writes/ below:

Which sorting algorithm makes minimum number of memory writes?

Which sorting algorithm makes minimum number of memory writes?

Last Updated : 23 Jul, 2025

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:

https://en.wikipedia.org/wiki/Cycle_sort https://en.wikipedia.org/wiki/Selection_sort

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4