I came to the following question
element and an integer k where k & lt; n . The element << em> a 0 ... one k } and { One k +1 ... is a n } Already given sorted ( n ) and an algorithm for sorting in O (1) space.
It does not seem to me that it can be done in O ( n ) time and O (1) space. The problem is actually asking how to merge the merge phase, but in-place if this is possible, can not it be merged in such a way? I am unable to explain myself and some opinion is needed.
This indicates that it is possible to do this in O (lg ^ 2 n) space. I can not see how it proves that it is impossible to merge into continuous space, but I can not see how to do it.
EDIT: Pursuing references, practice of Nute Volume 3 - 5.5.3 "A much more elaborate algorithm of L. Scrab-Pardo provides the best answer to this problem: ) It is possible to stabilize time steady and O (n LGG) in time, only O (LG N)
edit this article: This article claims that articles by Huang and Langston Has an algorithm that oh mi (m + n) The merger of the list of m and n of r, so will be the answer to your question. Unfortunately I do not have access to this article, so I should believe the information on the other side. I am not sure that harmony with the word of Nith How to do that the Trouble-Pardo algorithm is optimal. If my life was dependent on it, then I had to go with Nut.
Now I see that this and sometimes the stack overflow I do not have the heart to flag it as a duplicate.
Huang B-C and Langstown MA A, Practical In-Place Merging, Com. ACM 31 (1988). 348-352
Comments
Post a Comment