Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Priority queue
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Min-priority queue === * ''insert(S, element, priority)'':<ref name=":1" /><ref name=":2" /> add an element to set ''S'' with an associated priority. * ''minimum(S)'': return the element with ''lowest priority''. *: This is also known as "''find_min''". * ''extract_min(S)'': remove the element from set ''S'' with ''lowest priority'', and return it. *: This is also known as "''delete''",<ref name=":1" /> or "''extract''".<ref name=":2" /> * ''decrease_key(S, element, k)'': decrease the associated priority with an element to the new value ''k''. {{div col end}} [[Stack (abstract data type)|Stacks]] and [[Queue (abstract data type)|queues]] can be implemented as particular kinds of priority queues, with the priority determined by the order in which the elements are inserted. In a stack, the priority of each inserted element is monotonically increasing; thus, the last element inserted is always the first retrieved. In a queue, the priority of each inserted element is monotonically decreasing; thus, the first element inserted is always the first retrieved. In some implementations, if two elements have the same priority, they are served in the same order in which they were enqueued. In other implementations, the order of elements with the same priority is undefined.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)