Anthony D. Baye <Sha### [at] spamnomorehotmailcom> wrote:
> Has anyone written a relatively efficient array-based priority queue?
AFAIK a heap is usually used for priority queues because it can be
implemented inside an array (with no ancillary data whatsoever necessary),
insertion is an O(log n) operation, and getting the highest-priority element
is constant-time (removing it from the heap is O(log n)).
http://en.wikipedia.org/wiki/Heap_(data_structure)
--
- Warp
Post a reply to this message
|