Multiway in-place merging

  • Authors:
  • Viliam Geffert;Jozef Gajdo

  • Affiliations:
  • Department of Computer Science, P.J. afárik University, Jesenná 5, 04001 Koice, Slovakia;Department of Computer Science, P.J. afárik University, Jesenná 5, 04001 Koice, Slovakia

  • Venue:
  • Theoretical Computer Science
  • Year:
  • 2010

Quantified Score

Hi-index 5.23

Visualization

Abstract

We present an algorithm for asymptotically efficient k-way merging. Given an array A containing k sorted subsequences A"1,...,A"k of respective lengths n"1,...,n"k, where @?"i"="1^kn"i=n, our algorithm merges A"1,...,A"k into a single sorted sequence in-place and in linear time, performing c"k@?n+o(n) element comparisons and 3@?n+o(n) element moves, where c"k=@?lgk@?+2@?(1-2^@?^l^g^k^@?/k), which is a constant satisfying lgk@?c"k@?@?lgk@? and, moreover, bounded by c"k@?lgk+0.0861. The algorithm does not merge stably, however, it does not require that the elements in A are all distinct.