Average merge time: An intuitive interpretation

  • M. O'Keeffe
  • , M. Schellekens

Research output: Contribution to journalArticlepeer-review

Abstract

A classical result by Nagler ([1]) states that the average comparison time of the standard merge algorithm over merge pairs of size n, i.e. pairs of sorted lists of size n, is: T̄M(n,n) = 2n2/n+1 Nagler's proof sheds little light on the intuition which should be given to this quotient. We provide an intuitive interpretation of Nagler's result, based on the notion of an "alternation". This notion essentially represents a switch between the two lists in mergings "pop-the-top" process. We recall from ([2]) that the average number of alternations over all possible merge pairs of size n is n and provide a simplified proof of this fact. We show that the set of all merge pairs of size n which have exactly the average number of alternations turns out to be a "representative" of the entire set of merge pairs in the following sense: the average comparison time over all merge pairs, i.e. T̄M(n,n), is identical to the time T̄M[n,n] which merge takes when restricted to merge pairs which have exactly n alternations, i.e. merge pairs which have exactly the average number of alternations. Finally, we show that the average time, T̄M[n,n] = 2n2/n-1, can be expressed intuitively as the product of the average number of alternations by the average number of comparisons that occur between alternations.

Original languageEnglish
Pages (from-to)123-134
Number of pages12
JournalElectronic Notes in Theoretical Computer Science
Volume74
Publication statusPublished - Oct 2003

Fingerprint

Dive into the research topics of 'Average merge time: An intuitive interpretation'. Together they form a unique fingerprint.

Cite this