In-place Algorithm

In-place algorithms are algorithms that transform the input data without using extra space.

  • In-place algorithms are often used to optimize the space complexity of an algorithm.
  • In-place algorithms are also known as destructive algorithms because they destroy the input data.

Cons:

  • It is not suitable for multi-threaded environments or parallel processing, because it will modify the input data which may be read by other threads.