On the Optimality of Tape Merge of Two Lists with Similar Size

Authors Qian Li, Xiaoming Sun, Jialin Zhang

Thumbnail PDF


  • Filesize: 0.48 MB
  • 17 pages

Document Identifiers

Author Details

Qian Li
Xiaoming Sun
Jialin Zhang

Cite AsGet BibTex

Qian Li, Xiaoming Sun, and Jialin Zhang. On the Optimality of Tape Merge of Two Lists with Similar Size. In 27th International Symposium on Algorithms and Computation (ISAAC 2016). Leibniz International Proceedings in Informatics (LIPIcs), Volume 64, pp. 51:1-51:17, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2016)


The problem of merging sorted lists in the least number of pairwise comparisons has been solved completely only for a few special cases. Graham and Karp [TAOCP, 1999] independently discovered that the tape merge algorithm is optimal in the worst case when the two lists have the same size. Stockmeyer and Yao [SICOMP, 1980], Murphy and Paull [Inform. Control, 1979], and Christen [1978] independently showed when the lists to be merged are of size m and n satisfying m leq n leq floor(3/2 m) + 1, the tape merge algorithm is optimal in the worst case. This paper extends this result by showing that the tape merge algorithm is optimal in the worst case whenever the size of one list is no larger than 1.52 times the size of the other. The main tool we used to prove lower bounds is Knuth’s adversary methods [TAOCP, 1999]. In addition, we show that the lower bound cannot be improved to 1.8 via Knuth's adversary methods. We also develop a new inequality about Knuth's adversary methods, which might be interesting in its own right. Moreover, we design a simple procedure to achieve constant improvement of the upper bounds for 2m - 2 leq n leq 3m.
  • comparison-based sorting
  • tape merge
  • optimal sort
  • adversary method


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Miklós Ajtai, Vitaly Feldman, Avinatan Hassidim, and Jelani Nelson. Sorting and selection with imprecise comparisons. In Proceedings of the 36th International Colloquium on Automata, Languages and Programming: Part I, ICALP'09, pages 37-48, 2009. Google Scholar
  2. Mark R. Brown and Robert E. Tarjan. A fast merging algorithm. J. ACM, 26(2):211-226, 1979. Google Scholar
  3. Jean Cardinal and Samuel Fiorini. On Generalized Comparison-Based Sorting Problems, pages 164-175. Springer Berlin Heidelberg, 2013. Google Scholar
  4. Yongxi Cheng, Xiaoming Sun, and Yiqun Lisa Yin. Searching monotone multi-dimensional arrays. Discrete Mathematics, 308(11):2213-2221, 2008. Google Scholar
  5. C. Christen. Improving the bounds on optimal merging. In Proc 19th IEEE conf on the foundations of computer science, pages 259-266, 1978. Google Scholar
  6. C. Christen. On the optimality of the straight merging algorithm, 1978. Google Scholar
  7. W. Fernandez de la Vega, M. A. Frieze, and M. Santha. Average-case analysis of the merging algorithm of hwang and lin. Algorithmica, 22(4):483-489, 1998. Google Scholar
  8. Wenceslas Fernandez de la Vega, Sampath Kannan, and Miklos Santha. Two probabilistic results on merging. SIAM Journal on Computing, 22(2):261-271, 1993. Google Scholar
  9. Fănică Gavril. Merging with parallel processors. Commun. ACM, 18(10):588-591, 1975. Google Scholar
  10. A. Gupta and A. Kumar. Sorting and selection with structured costs. In Proceedings of the 42nd IEEE Symposium on Foundations of Computer Science, page 416, 2001. Google Scholar
  11. Bing-Chao Huang and Michael A. Langston. Practical in-place merging. Commun. ACM, 31(3):348-352, 1988. Google Scholar
  12. Z. Huang, S. Kannan, and S. Khanna. Algorithms for the generalized sorting problem. In Proceedings of the 52nd IEEE Symposium on Foundations of Computer Science, pages 738-747, 2011. Google Scholar
  13. F. K. Hwang and D. N. Deutsch. A class of merging algorithms. J. ACM, 20(1):148-159, 1973. Google Scholar
  14. Frank Hwang and Shen Lin. A simple algorithm for merging two disjoint linearly ordered sets. SIAM Journal on Computing, 1(1):31-39, 1972. Google Scholar
  15. Frank K. Hwang. Optimal merging of 3 elements with n elements. SIAM Journal on Computing, 9(2):298-320, 1980. Google Scholar
  16. Frank K. Hwang and Shen Lin. Optimal merging of 2 elements with n elements. Acta Informatica, 1(2):145-158, 1971. Google Scholar
  17. Sampath Kannan and Sanjeev Khanna. Selection with monotone comparison costs. In Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA'03, pages 10-17, 2003. Google Scholar
  18. Donald Knuth. The art of computer programming. Sorting and searching, 3:197-207, 1999. Google Scholar
  19. Qian Li, Xiaoming Sun, and Jialin Zhang. Tables of λmρ and the program, 2016. URL: http://theory.ict.ac.cn/liqian.
  20. N. Linial and M. Saks. Searching ordered structures. Journal of Algorithms, 6(1):86-103, 1985. Google Scholar
  21. Nathan Linial. The information-theoretic bound is good for merging. SIAM Journal on Computing, 13(4):795-801, 1984. Google Scholar
  22. G. K. Manacher, T. D. Bui, and T. Mai. Optimum combinations of sorting and merging. J. ACM, 36(2):290-334, 1989. Google Scholar
  23. Glenn K. Manacher. Significant improvements to the hwang-lin merging algorithm. J. ACM, 26(3):434-440, 1979. Google Scholar
  24. Paul E. Murphy and Marvin C. Paull. Minimum comparison merging of sets of approximately equal size. Information and Control, 42(1):87-96, 1979. Google Scholar
  25. P. E. Murphy. A problem in optimal meging. Technical Report DCS-TR-69, Rutgers University, Dept. of Computer Sciences, 1978. Google Scholar
  26. Jürgen Schulte Mönting. Merging of 4 or 5 elements with n elements. Theoretical Computer Science, 14(1):19-37, 1981. Google Scholar
  27. Warren D. Smith and Kevin J. Lang. Values of the merging function and algorithm design as a game, 1994. Google Scholar
  28. Paul K. Stockmeyer and F. Frances Yao. On the optimality of linear merge. SIAM Journal on Computing, 9(1):85-90, 1980. Google Scholar
  29. R. Michael. Tanner. Minimean merging and sorting: An algorithm. SIAM Journal on Computing, 7(1):18-38, 1978. Google Scholar
  30. Mai Thanh, V. S. Alagar, and T. D. Bui. Optimal expected-time algorithms for merging. Journal of Algorithms, 7(3):341-357, 1986. Google Scholar
  31. Mai Thanh and T. D. Bui. An improvement of the binary merge algorithm. BIT Numerical Mathematics, 22(4):454-462, 1982. Google Scholar
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail