Package COM.INFORMATIMAGO.COMMON-LISP.CESARUM.PRIORITY-QUEUE

undocumented

COPY-PQ

MAKE-PQ

pq
structure
Defines a priority queue data structure.
We keep the %queue sorted in a stubbed list.
The pq structure may be initialized with a LESSP function (default is <)
and with a KEY function (default is IDENTITY).
(pq-elements pq)
function
Returns a list containing the sorted elements in the priority queue. [O(length(pq))]
(setf (pq-elements pq) new-elements)
function
Replaces all the elements of PQ by the NEW-ELEMENTS (need not be sorted).
Returns NEW-ELEMENTS.
(pq-emptyp pq)
function
Whether the priority queue is empty.  [O(1)]
(pq-first pq)
function
Returns the first element of the priority queue.
(pq-insert pq element)
function
Inserts the element in order in the priority queue [O(length(pq))].
Returns the PQ.
(pq-insert* pq element)
function
Inserts the ((element . key)) in order in the priority queue [O(length(pq))].
Returns the PQ.

PQ-KEY

(pq-length pq)
function
The number of elements in the priority queue.  [O(length(pq))]

PQ-LESSP

PQ-P

(pq-pop pq)
function
Removes and returns the first element of the priority queue.
(pq-pop* pq)
function
Removes and returns the first element of the priority queue.
(pq-remove pq element)
function
Removes the first occurence of the element from the priority queue [O(length(pq))]
O(pq-remove pq (pq-first pq)) = O(1)
Returns the ELEMENT.