Merge sort without extra memory

is there any condition in which the merge sort can be performed without additional memory, my professor said he had, and he would give a bonus ball.

+3
source share
4 answers

You want google to host merge sort.

Here is one of the results: http://thomas.baudel.name/Visualisation/VisuTri/inplacestablesort.html

+1
source

Given that this is a homework question, I can only point out the art of programming. A good programmer should be able to use standard links in our field to investigate such a question.

0
source

,

0

Use linked list. This avoids the extra O (n) space needed when merging the two lists. However, you cannot do anything about the space occupied by recursion calls ie O (lg (n)).

0
source

Source: https://habr.com/ru/post/1721280/


All Articles