In-place

Use this tag on questions about algorithms that modify the data in-place, as opposed to making a copy

Mergesort

Merge sort is an O(n log n) worst-case comparison-based stable sorting algorithm.



Memory hard time

Example

"1 in-place merge sort is used when you want to sort a list in o nlogn time while using less space than standard mergesort"

from question  

In-place merge sort practical usage

"Another reason is that mergesort needs more memory because it s hard to implement it as an in-place sort"

from question  

Quicksort slower than Mergesort?

Others

Example

Mergesort is more difficult to implement in-place but the out-of-place version is very cache-friendly - i suspect real-world implementations accept the o n space overhead - ram is cheap but memory bandwidth is a major bottleneck so trading memory for cache-efficiency and speed is often a good deal

from question  

Sorting in place

Additionally mergesort traditionally requires o n of extra memory;there is an in-place variant but i think an in-place variant is significantly slower

from question  

Complexity in Algorithms

3 mergesort uses more memory because it creates two new arrays of half size for the two recursive calls;in-place merge sort and quick sort should take around the same space because 2 the whole purpose of sorting is the make the input arrays sorted so not sorted input arrays will be sorted by the in-place mergesort

from question  

In-place merge sort practical usage

Back to Home
Data comes from Stack Exchange with CC-BY-SA-4.0