Merge algorithm: Difference between revisions

Content deleted Content added
K-way merging: -repetition
Line 21:
<div style="margin-left: 35px; width: 600px">
{{framebox|blue}}
* Input: a sequence of {{mvar|k}} sequences.
* Build a min-heap {{mvar|h}} of the {{mvar|k}} sequences, using the first element as the key.
* While any of the sequences is non-empty:
Line 36 ⟶ 35:
<div style="margin-left: 35px; width: 600px">
{{framebox|blue}}
* Input: a sequence of {{mvar|k}} sequences.
* If {{math|''k'' {{=}} 1}}, output the single input sequence.
* If {{math|''k'' {{=}} 2}}, perform a binary merge.