comp • gb.data • prioqueue

PrioQueue (gb.data)

A PrioQueue, short for Priority Queue, is a more general type of Queue where all inserted elements are not strictly linearly queued. Instead they are first grouped by their priority index. The greater that index, the more important and thus the closer to the beginning of the PrioQueue this group is enqueued. With each group, the usual FIFO semantics of a Queue apply. So that, in effect, all elements can be ordered linearly again.

To range the PrioQueue into your mental hierarchy of concepts, observe that you can implement both a Queue and a Stack by using a PrioQueue: For each element to insert, get a logical timestamp. If you are building a Queue, this is your priority. If you are building a Stack, flip the sign of this number and this is your priority.

More information on priority queues is available on Wikipedia.

This class is
Dim hPrioQueue As PrioQueue
creatable
.

Properties

Methods
property Read IsEmpty As Boolean
IsEmpty  
property Read Size As Integer
Size  
Sub Clear ( )
Clear  
Function Deq ( ) As Variant
Deq  
Function Dequeue ( ) As Variant
Dequeue  
Sub Enq ( Value As Variant, Prio As Integer )
Enq  
Sub Enqueue ( Value As Variant, Prio As Integer )
Enqueue  
Function Peek ( ) As Variant
Peek  

See also

PrioSet