 <?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=Heap_as_array%3A_extract_minimum</id>
	<title>Heap as array: extract minimum - 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=Heap_as_array%3A_extract_minimum"/>
	<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Heap_as_array:_extract_minimum&amp;action=history"/>
	<updated>2026-05-11T03:39:17Z</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=Heap_as_array:_extract_minimum&amp;diff=3373&amp;oldid=prev</id>
		<title>Luedecke at 23:13, 19 June 2015</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Heap_as_array:_extract_minimum&amp;diff=3373&amp;oldid=prev"/>
		<updated>2015-06-19T23:13:08Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:13, 19 June 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;__NOTOC__&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Videos]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{#ev:youtube|https://www.youtube.com/watch?v=j-r4YOPFp7E|500|right||frame}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Checkup]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Checkup]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Algorithm]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Algorithm]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Luedecke</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Heap_as_array:_extract_minimum&amp;diff=508&amp;oldid=prev</id>
		<title>Cuozzo at 09:05, 1 October 2014</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Heap_as_array:_extract_minimum&amp;diff=508&amp;oldid=prev"/>
		<updated>2014-10-01T09:05:53Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:05, 1 October 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;__NOTOC__&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;__NOTOC__&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Checkup]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Algorithm]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Algorithm]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Method of an implementation of a data structure]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Method of an implementation of a data structure]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Cuozzo</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Heap_as_array:_extract_minimum&amp;diff=416&amp;oldid=prev</id>
		<title>Cuozzo: Created page with &quot;__NOTOC__ Category:Algorithm Category:Method of an implementation of a data structure '''Algorithmic problem:''' Bounded priority queue|Bounded priority queue: extra...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Heap_as_array:_extract_minimum&amp;diff=416&amp;oldid=prev"/>
		<updated>2014-09-30T15:06:45Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__ &lt;a href=&quot;/index.php?title=Category:Algorithm&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Algorithm (page does not exist)&quot;&gt;Category:Algorithm&lt;/a&gt; &lt;a href=&quot;/index.php?title=Category:Method_of_an_implementation_of_a_data_structure&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Method of an implementation of a data structure (page does not exist)&quot;&gt;Category:Method of an implementation of a data structure&lt;/a&gt; &amp;#039;&amp;#039;&amp;#039;Algorithmic problem:&amp;#039;&amp;#039;&amp;#039; Bounded priority queue|Bounded priority queue: extra...&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:Algorithm]]&lt;br /&gt;
[[Category:Method of an implementation of a data structure]]&lt;br /&gt;
'''Algorithmic problem:''' [[Bounded priority queue|Bounded priority queue: extract minimum]]&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:'''&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:'''&lt;br /&gt;
# A '''current index''' &amp;lt;math&amp;gt;k \in \mathbb{N}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# An auxiliary index &amp;lt;math&amp;gt;k' \in \mathbb{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract view==&lt;br /&gt;
'''Invariant:''' Before and after each iteration:&lt;br /&gt;
# The value of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is one less than immediately before the call to this method; one heap item has been removed, namely the one that was at position &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;&lt;br /&gt;
# The heap property is fulfilled for all heap items except for the one at index &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; (for that one, the heap property may or may not be fulfilled).&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is at least doubled.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' The heap property is fulfilled by &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; (note that the heap property is trivially fulfilled by &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; once &amp;lt;math&amp;gt;2 * k &amp;gt; N&amp;lt;/math&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==Induction basis==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# Overwrite &amp;lt;math&amp;gt;TheHeap[1]&amp;lt;/math&amp;gt; by &amp;lt;math&amp;gt;TheHeap[N]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Decrease &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; by one.&lt;br /&gt;
# Update &amp;lt;math&amp;gt;Positions&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;Unused&amp;lt;/math&amp;gt; accordingly.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Insert &amp;lt;math&amp;gt;TheHeap[1].ID&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;Unused&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;TheHeap[1].key := TheHeap[N].key&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;TheHeap[1].ID := TheHeap[N].ID&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;N := N-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;Positions[TheHeap[1].ID] := 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;k := 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
==Induction step==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# If the current heap item fulfills the heap property, terminate the algorithm.&lt;br /&gt;
# Otherwise, exchange the current heap item with one of its children, viz. the smaller one (ties arbitrarily broken). The index &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; follows the heap item.&lt;br /&gt;
&lt;br /&gt;
'''Implementation'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;2*k&amp;gt;N&amp;lt;/math&amp;gt;, terminate the algorithm.&lt;br /&gt;
# If &amp;lt;math&amp;gt;2*k+1&amp;gt;N&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt;k' := 2*k&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, set&lt;br /&gt;
## &amp;lt;math&amp;gt;k' := 2*k&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;TheHeap[2k] \le TheHeap[2k+1]&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;k' := 2*k+1&amp;lt;/math&amp;gt;, otherwise.&lt;br /&gt;
# If &amp;lt;math&amp;gt;TheHeap[k] \le TheHeap[k']&amp;lt;/math&amp;gt;, terminate the algorithm.&lt;br /&gt;
# Swap &amp;lt;math&amp;gt;Positions[TheHeap[k].ID]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;Positions[TheHeap[k'].ID]&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Swap &amp;lt;math&amp;gt;TheHeap[k].key&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;TheHeap[k'].key&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Swap &amp;lt;math&amp;gt;TheHeap[k].ID&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;TheHeap[k'].ID&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;k := k'&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Obviously, the heap item at the former position &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; now fulfills the heap property, and the new &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; is now the only index that does not necessarily fulfill it.&lt;br /&gt;
&lt;br /&gt;
==Complexity==&lt;br /&gt;
'''Statement:''' The asymptotic complexity is logarithmic in the worst case.&lt;br /&gt;
'''Proof:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>Cuozzo</name></author>
	</entry>
</feed>