Abstract

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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Bentley, J.: Programming Pearls, 2nd edn. Addison-Wesley, Reading (2000)Google Scholar
  2. 2.
    Chen, J.: Optimizing stable in-place merging. Theoretical Computer Science 302(1/3), 191–210 (2003)MATHCrossRefMathSciNetGoogle Scholar
  3. 3.
    Dudzinski, K., Dydek, A.: On a stable storage merging algorithm. Information Processing Letters 12(1), 5–8 (1981)MATHCrossRefMathSciNetGoogle Scholar
  4. 4.
    Geffert, V., Katajainen, J., Pasanen, T.: Asymptotically efficient in-place merging. Theoretical Computer Science 237(1/2), 159–181 (2000)MATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    Hwang, F.K., Lin, S.: A simple algorithm for merging two disjoint linearly ordered sets. SIAM J. Comput. 1(1), 31–39 (1972)MATHCrossRefMathSciNetGoogle Scholar
  6. 6.
    Kim, P.-S., Kutzner, A.: On optimal and efficient in place merging. In: Wiedermann, J., Tel, G., Pokorný, J., Bieliková, M., Štuller, J. (eds.) SOFSEM 2006. LNCS, vol. 3831, pp. 350–359. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  7. 7.
    Knuth, D.E.: The Art of Computer Programming. Sorting and Searching, vol. 3. Addison-Wesley, Reading (1973)Google Scholar
  8. 8.
    Mannila, H.: A simple linear-time algorithm for in situ merging. Information Processing Letters 18, 203–208 (1984)CrossRefMathSciNetGoogle Scholar
  9. 9.
    Pardo, L.T.: Stable sorting and merging with optimal space and time bounds. SIAM Journal on Computing 6(2), 351–372 (1977)MATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    Symvonis, A.: Optimal stable merging. Computer Journal 38, 681–690 (1995)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Pok-Son Kim
    • 1
  • Arne Kutzner
    • 2
  1. 1.Department of MathematicsKookmin UniversitySeoulRep. of Korea
  2. 2.Department of Computer ScienceSeokyeong UniversitySeoulRep. of Korea

Personalised recommendations