A Provably, Linear Time, In-place and Stable Merge Algorithm via the Perfect Shuffle
نویسندگان
چکیده
We reconsider a previously published (Dalkilic et al.) algorithm for merging lists by way of the perfect shuffle permutation. The original publication gave only experimental results which, although consistent with linear execution time on the samples tested, provided no analysis. Here we prove that the time complexity, in the average case, is indeed linear, although there is a Θ(n) worst case. This is then the first provably linear time merge algorithm based on the use of the perfect shuffle. We provide a proof of correctness, extend the algorithm to the general case where the lists are of unequal length and show how it can be made stable, all aspects not included in the original presentation and we give a much more concise definition of the algorithm. keywords: algorithms, perfect shuffle, merging, sorting, stability. ∗This work was supported in part by the Natural Sciences and Engineering Research Council of Canada
منابع مشابه
The Cycles of the Multiway Perfect Shuffle Permutation
The (k,n)-perfect shuffle, a generalisation of the 2-way perfect shuffle, cuts a deck of kn cards into k equal size decks and interleaves them perfectly with the first card of the last deck at the top, the first card of the second-to-last deck as the second card, and so on. It is formally defined to be the permutation ρk,n : i→ ki (mod kn + 1), i ∈ {1,2, . . . ,kn}. We uncover the cycle structu...
متن کاملA Simple In-Place Algorithm for In-Shuffle
The paper presents a simple, linear time, in-place algorithm for performing a 2-way in-shuffle which can be used with little modification for certain other k-way shuffles.
متن کاملIn situ, Stable Merging by Way of the Perfect Shuffle
We introduce a novel approach to the classical problem of in-situ, stable merging, where \in-situ" means the use of no more than O(log 2 n) bits of extra memory for lists of size n. Shuuemerge reduces the merging problem to the problem of realising the \perfect shuue" permutation, that is, the exact interleaving of two, equal length lists. The algorithm is recursive, using a logarithmic number ...
متن کاملParallel and sequential in-place permuting and perfect shuffling using involutions
Every permutation of {1, 2, . . . , N} can be written as the product of two involutions. As a consequence, any permutation of the elements of an array can be performed in-place using simultaneous swaps in two rounds of swaps. In the case where the permutation is the k-way perfect shuffle we develop two methods for efficiently computing the pair of involutions that accomplishes these swaps. The ...
متن کاملIn-place permuting and perfect shuffling using involutions
Every permutation of {1, 2, . . . , N} can be written as the product of two involutions. As a consequence, any permutation of the elements of an array can be performed in-place using simultaneous swaps in two rounds of swaps. In the case where the permutation is the k-way perfect shuffle we develop two methods for efficiently computing the pair of involutions that accomplishes these swaps. The ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- CoRR
دوره abs/1508.00292 شماره
صفحات -
تاریخ انتشار 2015