In situ, Stable Merging by Way of the Perfect ShuffleThe Computer Journal, Vol. 43, No. 1. (1 January 2000), pp. 40-53.
|
Reviews
[Write a review of this article]
There are no reviews of this article
Find related articles from these CiteULike users
Find related articles with these CiteULike tags
AbstractWe introduce a novel approach to the classical problem of the in situ, stable merging of lists, where in situ' means the use of no more than $O(\log^2 n)$ bits of extra memory for lists of size $n$. Our algorithm, Shufflemerge, reduces the merging problem to the problem of realizing the perfect shuffle' permutation, that is, the exact interleaving of two, equal length lists. The algorithm is recursive and so uses a logarithmic number of variables. Thus it uses more than absolutely minimum storage', i.e. $O(\log n)$ bits. A simple method of realizing the perfect shuffle uses one extra bit per element, and so is not in situ. We show that the perfect shuffle can be attained using absolutely minimum storage and in linear time, at the expense of doubling the number of moves, relative to the simple method. We note that there is a worst case for Shufflemerge requiring time $Ω(n \log n)$, where $n$ is the sum of the lengths of the input lists. We also present an analysis of a variant of Shufflemerge which uses a generalized shuffle and which has a provable average case time complexity of $O(n\log \log m)$, where $m$ is the length of the shortest input list. It is unlikely that the generalized shuffle can be achieved in situ. Linear time, in situ, stable merging has previously been demonstrated. We present experimental evidence indicating that Shufflemerge, although almost certainly not asymptotically linear, might be of value in practice. The relative simplicity of the basic method, particularly with respect to stability, also recommends it. 10.1093/comjnl/43.1.40
BibTeX record
RIS record