View source: R/40-priority_queue-queue-ops.R
| pop_max | R Documentation |
Removes one maximum-priority element and returns it with the remaining queue.
pop_max(x)
x |
A |
Ties are stable: when multiple elements share maximum 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, 3, 3))
out <- pop_max(x)
out$value
out$priority
out$remaining
pop_max(priority_queue())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.