Algorithms in Computer Science are classified into various categories depending on diverse characteristics of the algorithms and also on the resource usage of them. In-place and out-of-place are one of such categorization depending on the extra memory space used by an algorithm to solve a problem. Let us consider each one separately. In-place algorithms In-place algorithms convert the input in to an output without allocating extra memory space for the process of problem solving. It uses the available space given as the input and replaces input with output. An in-place algorithm can use some small amount of non-constant additional memory. The additional space of O (log n) is the accepted limit but sometimes lower than O(n) is also approved. Bubble sort and Selection sort are two in-place algorithms in the context. Out-of-place algorithms An out-of-place algorithm is the opposite of in-place and needs growing amount of memory (usually O(n) or bigger than that) to process the input into o...
A blog that help learn front-end development, data structures and algorithms.