Computing Atlas

How Computing Was Built
Sign In
Text size
100%
Theme
Concept

In-place algorithm

Algorithm

An in-place algorithm is a method for transforming data that rewrites the same memory the input already occupies, rather than building a separate copy to hold the result. Because it needs only a small, fixed amount of extra working space regardless of how large the input is, an in-place algorithm can process data using far less memory than an equivalent method that allocates a new structure for its output, which matters most when the input is very large or memory is limited. Classic sorting methods are commonly implemented in place, swapping elements within the original array as they work, while an algorithm that is not implemented this way is sometimes described as out-of-place, and instead requires additional storage proportional to the size of the input.

Facts
Core Principle
it modifies the input in place, without creating a separate copy of the data structure 1
Sources
1. In-place Algorithm (Wikipedia)
Lead summary
Quote, Lead summary
In other words, it modifies the input in place, without creating a separate copy of the data structure.
View the Source
Comments (0)
No comments yet. Be the first to share a thought.
Reader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.