PriorityQueue

Priority queue over comparable items with heap-style insertion and top-element access.


PriorityQueue

Construct with an item schema in front of the module name, for example Int32 PriorityQueue.

Fields

Public methods

Internal helpers


Ordering and empty state


Examples

Runtime example: empty state, size, and top

"PriorityQueue" use
"String" use
"control" use

{} Int32 {} [
  q: Int32 PriorityQueue;
  ("empty0=" q.empty LF) printList
  10 @q.push
  3 @q.push
  20 @q.push
  ("size=" q.getSize LF
   "top=" @q.top new LF
   "empty1=" q.empty LF) printList
  0
] "main" exportFunction

Expected Output

empty0=TRUE
size=3
top=20
empty1=FALSE

See also