Re: An efficient way of sequencing streams of integers
- From: Ben Pfaff <blp@xxxxxxxxxxxxxxx>
- Date: Sun, 25 Feb 2007 15:04:39 -0800
Chris <spam_me_not@xxxxxxxxxx> writes:
I have N streams of integers. Each stream returns integers, one at a
time, in ascending order. I need to merge the streams so that that the
next integer is always the lowest available integer across the
streams. The streams are of random length. The length of each stream
is known in advance.
This is just called a "merge" and it's treated in many basic
texts, include Knuth.
I'd suggest a binary heap as a first try.
--
Peter Seebach on managing engineers:
"It's like herding cats, only most of the engineers are already
sick of laser pointers."
.
- References:
- Prev by Date: An efficient way of sequencing streams of integers
- Next by Date: Re: A restricted case of graph coloring, is this a known problem?
- Previous by thread: An efficient way of sequencing streams of integers
- Index(es):