View source: R/40-priority_queue-queue-ops.R
| pop_min | R Documentation |
Removes one minimum-priority element and returns it with the remaining queue.
pop_min(x)
x |
A |
Ties are stable: when multiple elements share minimum priority, the earliest element in queue order is removed.
A list with fields:
value: removed element, or NULL when x is empty.
priority: removed priority, or NULL when x is empty.
remaining: queue after removal.
x <- priority_queue("a", "b", "c", priorities = c(2, 1, 1))
out <- pop_min(x)
out$value
out$priority
out$remaining
pop_min(priority_queue())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.