in-place algorithm

An algorithm that rearranges its input within the input's own memory, using only a constant amount of extra space.

In more detail

Reversing a list by swapping the two ends inward, and quicksort's partition step, are in place. They save memory but modify the input, which is not always acceptable if the caller still needs the original. Python's list.sort() sorts in place, while sorted() returns a new list.

Related terms

Taught in

References