Prioqueue v0.2.1 Prioqueue.Protocol protocol View Source
Link to this section Summary
Functions
Returns true
if (and only if) the Priority Queue is empty
Extracts the current minimum from the Priority Queue,
according to the ordering introduced by the Priority Queue’s cmp_fun
Inserts item
at the correct ordering place inside prioqueue
,
Returns true
if data equal to item
is inside of prioqueue
,
Peeks at the current minimum item from the Priority Queue,
according to the ordering introduced by the Priority Queue’s cmp_fun
Returns the number of elements currently stored in the Priority Queue
Returns the Priority Queue in list form
Link to this section Types
Link to this section Functions
Returns true
if (and only if) the Priority Queue is empty.
This is a lot faster than checking if the size is nonzero.
Extracts the current minimum from the Priority Queue,
according to the ordering introduced by the Priority Queue’s cmp_fun
.
Runs in O(log n).
Returns {:ok, {item, priority_queue_without_item}}
, or :error
if the priority queue is empty.
Inserts item
at the correct ordering place inside prioqueue
,
according to the ordering introduced by the Priority Queue’s cmp_fun
.
Runs in O(log n).
member?(prioqueue, item :: any) :: boolean
Returns true
if data equal to item
is inside of prioqueue
,
according to the result of calling the priority queue’s comparison function.
peek_min(Prioqueue.t) :: {:ok, item :: any} | :error
Peeks at the current minimum item from the Priority Queue,
according to the ordering introduced by the Priority Queue’s cmp_fun
.
Runs in O(1).
Returns {:ok, item}
, or :error
if the priority queue is empty.
Returns the number of elements currently stored in the Priority Queue.
Returns the Priority Queue in list form.
Note that the first-to-be-extracted element appears as the head of the list.