Ratio Based Stable In-Place Merging

DOI: 10.1007/978-3-540-79228-4_22
Source: DBLP


We investigate the problem of stable in-place merging from a ratio

based point of view where m,n are the sizes of the input sequences with m ≤ n . We introduce a novel algorithm for this problem that is asymptotically optimal regarding the number of assignments as well
as comparisons. Our algorithm uses knowledge about the ratio of the input sizes to gain optimality and does not stay in the
tradition of Mannila and Ukkonen’s work [8] in contrast to all other stable in-place merging algorithms proposed so far. It
has a simple modular structure and does not demand the additional extraction of a movement imitation buffer as needed by its
competitors. For its core components we give concrete implementations in form of Pseudo Code. Using benchmarking we prove
that our algorithm performs almost always better than its direct competitor proposed in [6].

As additional sub-result we show that stable in-place merging is a quite simple problem for every ratio
k ³ Ömk\geq\sqrt{m}
by proving that there exists a primitive algorithm that is asymptotically optimal for such ratios.

1,395 Reads
  • Source
    [Show abstract] [Hide abstract]
    ABSTRACT: In 2000, Geffert et al. (Theoret. Comput. Sci. 237 (2000) 159) presented an asymptotically efficient algorithm for stable merging in constant extra space. The algorithm requires at most m1(t+1)+m2/2t+o(m1) comparisons (t=⌊log2(m2/m1)⌋) and 5m2+12m1+o(m1) moves, where m1 and m2 are the sizes of two ordered sublists to be merged, and m1⩽m2. This paper optimizes the algorithm. The optimized algorithm is simpler than their algorithm, and makes at most m1(t+1)+m2/2t+o(m1+m2) comparisons and 6m2+7m1+o(m1+m2) moves.
    Theoretical Computer Science 06/2003; 302(1-3-302):191-210. DOI:10.1016/S0304-3975(02)00775-2 · 0.66 Impact Factor
  • Information Processing Letters 02/1981; 12(1):5-8. DOI:10.1016/0020-0190(81)90065-X · 0.55 Impact Factor
  • Source
    [Show abstract] [Hide abstract]
    ABSTRACT: Two linear-time algorithms for in-place merging are presented. Both algorithms perform at most m(t+1)+n=2 t +o(m) comparisons, where m and n are the sizes of the input sequences, m n, and t = blog 2 (n=m)c. The first algorithm is for unstable merging and it carries out no more than 3(n+m)+o(m) element moves. The second algorithm is for stable merging and it accomplishes at most 5n+12m+o(m) moves. Key words: In-place algorithms, merging, sorting ? A preliminary and weaker version of this work appeared in Proceedings of the 20th Symposium on Mathematical Foundations of Computer Science, Lecture Notes in Computer Science 969, Springer-Verlag, Berlin/Heidelberg (1995), 211--220. 1 Supported by the Slovak Grant Agency for Science under contract 1/4376/97 (Project "Combinational Structures and Complexity of Algorithms"). 2 Partially supported by the Danish Natural Science Research Council under contracts 9400952 (Project "Computational Algorithmics") and 9701414 (Project "Experimental Algorithmics"). Preprint submitted to Elsevier Preprint December 19, 1995 1
    Theoretical Computer Science 04/2000; 237(1-2-237):159-181. DOI:10.1016/S0304-3975(98)00162-5 · 0.66 Impact Factor
Show more


1,395 Reads
Available from