comp.lang.ada
 help / color / mirror / Atom feed
From: jones@pyrite.cs.uiowa.edu (Douglas W. Jones,201H MLH,3193350740,3193382879)
Subject: Re: binary heap
Date: 15 Nov 1994 17:31:39 GMT
Date: 1994-11-15T17:31:39+00:00	[thread overview]
Message-ID: <3aar9r$ks7@nexus.uiowa.edu> (raw)
In-Reply-To: CzBGEz.6D4@inmet.camb.inmet.com

In article <CzA7FF.K7s@inmet.camb.inmet.com>,
Tucker Taft <stt@spock.camb.inmet.com> wrote:
 
>Here is some Ada 83 code for a binary heap used to implement a priority 
>queue (FIFO within priority); this code (or a slight variation of it)
>has been used successfully for many years.

But note that the binary heap, by the benchmarks I published some years
ago, is about a factor of 2 slower than splay trees under the hold model
(repeated steady-state insertion and deletion in a priority queue), and
note that the heap requires that you know the maximum size of the
priority queue in advance.  Splay trees, being based on binary trees,
are limited only by available memory.

You can get my code from the STARS library or from:

	ftp://ftp.cs.uiowa.edu/pub/jones/event/splayada.txt.Z

This is a generic Ada package.  Although it's written and documented in
terms of discrete event simulation, it is easy to use as a general puprose
priority queue (the generic parameter TIME_TYPE is the type to be used
for the priority field; all that is required is that there be an ">"
operator.  The generic parameter AUX_TYPE is the data enqueued in the
priority queue.
				Doug Jones
				jones@cs.uiowa.edu



      reply	other threads:[~1994-11-15 17:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-11-09 12:21 binary heap JC
1994-11-14 23:47 ` Tucker Taft
1994-11-15 15:59   ` Tucker Taft
1994-11-15 17:31     ` Douglas W. Jones,201H MLH,3193350740,3193382879 [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox