Ratio Based Stable In-Place Merging

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

ABSTRACT 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.

  • 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
  • Information Processing Letters 02/1981; 12:5-8. DOI:10.1016/0020-0190(81)90065-X
  • Source
    [Show abstract] [Hide abstract]
    ABSTRACT: Two linear-time algorithms for in-place/ merging are presented. Both algorithms perform at most comparisons, where m and n are the sizes of the input sequences, m⩽n, and . The first algorithm is for unstable/ merging and it carries out no more than element moves. The second algorithm is for stable/ merging and it accomplishes at most moves.
    Theoretical Computer Science 04/2000; 237(1-2-237):159-181. DOI:10.1016/S0304-3975(98)00162-5


Available from