to sorting implying that if we can sort up to n keys in S(n) time per key, then there is a priority queue supporting delete and insert in O(S(n)) time and find-min in constant time. That is, if there is a sorting algorithm which can sort in O(S) time per key, where S is some function of n and word size, then one can use the given procedure to create a priority queue where pulling the highest-priority element is O(1) time, and inserting new elements (and deleting elements) is O(S) time. For example, if one has an O(n log n) sort algorithm, one can create a priority queue with O(1) pulling and O( log n) insertion. Libraries A priority queue is often considered to be a "container data structure". The Standard Template Library (STL), and the C++ 1998 standard, specifies std::priority_queue as one of the STL container adaptor class templates. However, it does not specify how two elements with same priority should be served, and indeed, common implementations will not return them according to their order in the queue. It implements a max-priority-queue, and has three parameters: a comparison object for sorting such as a function object (defaults to less<T> if unspecified), the underlying container for storing the data structures (defaults to std::vector<T>), and two iterators to the beginning and end of a sequence. Unlike actual STL containers, it does not allow iteration of its elements (it strictly adheres to its abstract data type definition). STL also has utility functions for manipulating another random-access container as a binary max-heap. The Boost libraries also have an implementation in the library heap. Python's heapq module implements a binary min-heap on top of a list. Java's library contains a class, which implements a min-priority-queue. .NET's library contains a PriorityQueue class, which implements an array-backed, quaternary min-heap. Scala's library contains a PriorityQueue class, which implements a max-priority-queue. Go's library contains a container/heap module, which implements a min-heap on top of any compatible data structure. The Standard PHP Library extension contains the class SplPriorityQueue. Apple's Core Foundation framework contains a CFBinaryHeap structure, which implements a min-heap. Applications Bandwidth management Priority queuing can be used to manage limited resources such as bandwidth on a transmission line from a network router. In the event of outgoing traffic queuing due to insufficient bandwidth, all other queues can be halted to send the traffic from the highest priority queue