 <?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?action=history&amp;feed=atom&amp;title=Priority_queue</id>
	<title>Priority queue - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?action=history&amp;feed=atom&amp;title=Priority_queue"/>
	<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Priority_queue&amp;action=history"/>
	<updated>2026-05-15T06:14:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Priority_queue&amp;diff=615&amp;oldid=prev</id>
		<title>Cuozzo: Created page with &quot;__NOTOC__ Category:Checkup Category:Abstract Data Structure Category:Sequence ==General information== '''Representation invariant''' # The abstract data structure...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Priority_queue&amp;diff=615&amp;oldid=prev"/>
		<updated>2014-10-04T15:33:42Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__ &lt;a href=&quot;/index.php?title=Category:Checkup&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Checkup (page does not exist)&quot;&gt;Category:Checkup&lt;/a&gt; &lt;a href=&quot;/index.php?title=Category:Abstract_Data_Structure&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Abstract Data Structure (page does not exist)&quot;&gt;Category:Abstract Data Structure&lt;/a&gt; &lt;a href=&quot;/index.php?title=Category:Sequence&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Sequence (page does not exist)&quot;&gt;Category:Sequence&lt;/a&gt; ==General information== &amp;#039;&amp;#039;&amp;#039;Representation invariant&amp;#039;&amp;#039;&amp;#039; # The abstract data structure...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
[[Category:Checkup]]&lt;br /&gt;
[[Category:Abstract Data Structure]]&lt;br /&gt;
[[Category:Sequence]]&lt;br /&gt;
==General information==&lt;br /&gt;
'''Representation invariant'''&lt;br /&gt;
# The abstract data structure '''priority queue''' implements [[Sets and sequences#Ordered and sorted sequences|ordered sequences]].&lt;br /&gt;
# This abstract data structure is [[Genericity|generic]] and parameterized by a fixed '''key type''' &amp;lt;math&amp;gt;\mathcal{K}&amp;lt;/math&amp;gt; and a fixed [[Genericity#Comparison|comparison]] &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt; defined on &amp;lt;math&amp;gt;\mathcal{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# An object with key type &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt; represents a finite, dynamically changing [[Sets and sequences|multiset]], whose elements are of type &amp;lt;math&amp;gt;\mathcal{K}&amp;lt;/math&amp;gt; (the multiset may be empty).&lt;br /&gt;
# Let &amp;lt;math&amp;gt;K_{1}, K_{2} \in \mathcal{K}&amp;lt;/math&amp;gt; be two values currently stored in the priority queue object such that &amp;lt;math&amp;gt;K_{1} \le K_{2}&amp;lt;/math&amp;gt;. Then &amp;lt;math&amp;gt;K_{1}&amp;lt;/math&amp;gt; will leave the queue earlier when the method &amp;lt;math&amp;gt;pop&amp;lt;/math&amp;gt; is used than &amp;lt;math&amp;gt;K_{2}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Constructor:''' Gets a [[Genericity#Comparison|comparison]] &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt; and initializes the queue so as to be empty.&lt;br /&gt;
&lt;br /&gt;
==Method==&lt;br /&gt;
'''Name:''' &amp;lt;math&amp;gt;push&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Input:''' A key &amp;lt;math&amp;gt;K \in \mathcal{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Output:''' &amp;lt;math&amp;gt;\in \N&amp;lt;/math&amp;gt;. A unique and permanent ID that identifies the inserted heap item.&lt;br /&gt;
&lt;br /&gt;
'''Precondition:''' -&lt;br /&gt;
&lt;br /&gt;
'''Postcondition:''' A new element with the key &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt; is inserted into the queue.&lt;br /&gt;
&lt;br /&gt;
==Method==&lt;br /&gt;
'''Name:''' &amp;lt;math&amp;gt;pop&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Input:''' -&lt;br /&gt;
&lt;br /&gt;
'''Output:''' &amp;lt;math&amp;gt;\in \mathcal{K}&amp;lt;/math&amp;gt;. Returns the minimum key &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt; currently within the queue.&lt;br /&gt;
&lt;br /&gt;
'''Precondition:''' There should be at least one item left in the queue &amp;lt;math&amp;gt;n&amp;gt;0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Postcondition:''' The length of the queue is smaller by one and the minimum key &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt; is dequeued.&lt;br /&gt;
&lt;br /&gt;
==Method==&lt;br /&gt;
'''Name:''' &amp;lt;math&amp;gt;peek&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Input:''' -&lt;br /&gt;
&lt;br /&gt;
'''Output:''' &amp;lt;math&amp;gt;\in \mathcal{K}&amp;lt;/math&amp;gt;. Returns the minimum key &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt; currently within the queue or &amp;lt;math&amp;gt;void&amp;lt;/math&amp;gt; if the queue is empty.&lt;br /&gt;
&lt;br /&gt;
'''Precondition:''' -&lt;br /&gt;
&lt;br /&gt;
'''Postcondition:''' -&lt;br /&gt;
&lt;br /&gt;
==Method==&lt;br /&gt;
'''Name:''' &amp;lt;math&amp;gt;decreaseKey&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Input:''' A natural number &amp;lt;math&amp;gt;ID \in \N&amp;lt;/math&amp;gt; presenting the heap item &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; to be changed, a key &amp;lt;math&amp;gt;K \in \mathcal{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Output:''' -&lt;br /&gt;
&lt;br /&gt;
'''Precondition:'''&lt;br /&gt;
# A valid ID currently found within the heap &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;1 \le ID \le N&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;K \le A[Positions[ID]].key&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Postcondition:''' The heap item &amp;lt;math&amp;gt;h&amp;lt;/math&amp;gt; has the new &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;. Its position within the heap afterwards is stored accordingly in &amp;lt;math&amp;gt;Positions[ID]&amp;lt;/math&amp;gt; and remains at the same or a higher level than before.&lt;/div&gt;</summary>
		<author><name>Cuozzo</name></author>
	</entry>
</feed>