Ratio Based Stable In-Place Merging

DOI: 10.1007/978-3-540-79228-4_22 In book: Theory and Applications of Models of Computation, pp.246-257
Source: DBLP


We investigate the problem of stable in-place merging from a ratio \(k=\frac{n}{m}\) 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\geq\sqrt{m}\) by proving that there exists a primitive algorithm that is asymptotically optimal for such ratios.