<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.algo.informatik.tu-darmstadt.de/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=JanR</id>
	<title>Algowiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.algo.informatik.tu-darmstadt.de/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=JanR"/>
	<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/Special:Contributions/JanR"/>
	<updated>2026-05-09T18:08:24Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Selection_sort&amp;diff=3462</id>
		<title>Selection sort</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Selection_sort&amp;diff=3462"/>
		<updated>2015-06-22T12:31:13Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Sorting Algorithms]]&lt;br /&gt;
&amp;lt;div class=&amp;quot;plainlinks&amp;quot; style=&amp;quot;float:right;margin:0 0 5px 5px; border:1px solid #AAAAAA; width:auto; padding:1em; margin: 0px 0px 1em 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.8em;font-weight:bold;text-align: center;margin:0.2em 0 1em 0&amp;quot;&amp;gt;Selection Sort&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.2em; margin:.5em 0 1em 0; text-align:center&amp;quot;&amp;gt;whatever&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.2em; margin:.5em 0 .5em 0;text-align:center&amp;quot;&amp;gt;[[File:olw_logo1.png|20px]][https://openlearnware.tu-darmstadt.de/#!/resource/selection-sort-1948 Openlearnware]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General information ==&lt;br /&gt;
&lt;br /&gt;
'''Algorithmic problem:''' [[Sorting based on pairwise comparison]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt;i \geq 0&amp;lt;/math&amp;gt; iterations: The elements at positions &amp;lt;math&amp;gt;|S|-i+1,\dots,|S|&amp;lt;/math&amp;gt; are correctly placed in sorting order.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;i = |S| - 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' Nothing to do.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Nothing to do.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' Identify the maximum out of &amp;lt;math&amp;gt;S[1],\dots,S[|S|-i+1]&amp;lt;/math&amp;gt; and then move it, by a swap, to position &amp;lt;math&amp;gt;|S|-i+1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m := 1&amp;lt;/math&amp;gt;&lt;br /&gt;
# For all &amp;lt;math&amp;gt;j=2,\dots,|S|-i+1&amp;lt;/math&amp;gt;: If &amp;lt;math&amp;gt;S[j] &amp;gt; S[m]&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;m := j&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Swap &amp;lt;math&amp;gt;S[m]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[|S|-i+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Obviously: &amp;lt;math&amp;gt;S[m]&amp;lt;/math&amp;gt; is the maximum element out of &amp;lt;math&amp;gt;S[1],\dots,S[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' The asymptotic complexity is in &amp;lt;math&amp;gt;\Theta(T\cdot n^2)&amp;lt;/math&amp;gt; in the best and worst case, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the complexity of the comparison.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The asymptotic complexity of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th iteration is in &amp;lt;math&amp;gt;\Theta(T\cdot(n - i))&amp;lt;/math&amp;gt;. Therefore, the total complexity is in &amp;lt;math&amp;gt;\Theta\left(T\cdot\sum_{i=1}^{n-1} (n-i) \right) = \Theta\left(T\cdot\sum_{i=1}^{n-1} i \right) = \Theta\left(T\cdot\frac{n(n-1)}{2} \right) = \Theta\left(T\cdot n^2\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
== Java Code Reverse Selectionsort ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	     	&lt;br /&gt;
     int[] selectionSort(int [] list) {&lt;br /&gt;
&lt;br /&gt;
        int n = list.length - 1;&lt;br /&gt;
        int left = 0;&lt;br /&gt;
        int min;&lt;br /&gt;
        int tmp;&lt;br /&gt;
&lt;br /&gt;
        while(left &amp;lt; n) {&lt;br /&gt;
            min = left;&lt;br /&gt;
            for(int i = left + 1; i&amp;lt;=n; i++) {&lt;br /&gt;
                if (list[i] &amp;lt; list[min]) {&lt;br /&gt;
                    min = i;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            tmp = list[min];&lt;br /&gt;
            list[min] = list[left];&lt;br /&gt;
            list[left] = tmp;&lt;br /&gt;
            left = left + 1;&lt;br /&gt;
        }&lt;br /&gt;
        return list;&lt;br /&gt;
    }	&lt;br /&gt;
    	&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Selection_sort&amp;diff=3345</id>
		<title>Selection sort</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Selection_sort&amp;diff=3345"/>
		<updated>2015-06-19T15:48:00Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Java Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Sorting Algorithms]]&lt;br /&gt;
&amp;lt;div class=&amp;quot;plainlinks&amp;quot; style=&amp;quot;float:right;margin:0 0 5px 5px; border:1px solid #AAAAAA; width:auto; padding:1em; margin: 0px 0px 1em 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.8em;font-weight:bold;text-align: center;margin:0.2em 0 1em 0&amp;quot;&amp;gt;Selection Sort&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.2em; margin:.5em 0 1em 0; text-align:center&amp;quot;&amp;gt;whatever&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.2em; margin:.5em 0 .5em 0;text-align:center&amp;quot;&amp;gt;[[File:olw_logo1.png|20px]][https://openlearnware.tu-darmstadt.de/#!/resource/selection-sort-1948 Openlearnware]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General information ==&lt;br /&gt;
&lt;br /&gt;
'''Algorithmic problem:''' [[Sorting based on pairwise comparison]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt;i \geq 0&amp;lt;/math&amp;gt; iterations: The elements at positions &amp;lt;math&amp;gt;|S|-i+1,\dots,|S|&amp;lt;/math&amp;gt; are correctly placed in sorting order.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;i = |S| - 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' Nothing to do.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Nothing to do.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' Identify the maximum out of &amp;lt;math&amp;gt;S[1],\dots,S[|S|-i+1]&amp;lt;/math&amp;gt; and then move it, by a swap, to position &amp;lt;math&amp;gt;|S|-i+1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m := 1&amp;lt;/math&amp;gt;&lt;br /&gt;
# For all &amp;lt;math&amp;gt;j=2,\dots,|S|-i+1&amp;lt;/math&amp;gt;: If &amp;lt;math&amp;gt;S[j] &amp;gt; S[m]&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;m := j&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Swap &amp;lt;math&amp;gt;S[m]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[|S|-i+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Obviously: &amp;lt;math&amp;gt;S[m]&amp;lt;/math&amp;gt; is the maximum element out of &amp;lt;math&amp;gt;S[1],\dots,S[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' The asymptotic complexity is in &amp;lt;math&amp;gt;\Theta(T\cdot n^2)&amp;lt;/math&amp;gt; in the best and worst case, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the complexity of the comparison.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The asymptotic complexity of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th iteration is in &amp;lt;math&amp;gt;\Theta(T\cdot(n - i))&amp;lt;/math&amp;gt;. Therefore, the total complexity is in &amp;lt;math&amp;gt;\Theta\left(T\cdot\sum_{i=1}^{n-1} (n-i) \right) = \Theta\left(T\cdot\sum_{i=1}^{n-1} i \right) = \Theta\left(T\cdot\frac{n(n-1)}{2} \right) = \Theta\left(T\cdot n^2\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
== Java Code ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	     	&lt;br /&gt;
     int[] selectionSort(int [] list) {&lt;br /&gt;
&lt;br /&gt;
        int n = list.length - 1;&lt;br /&gt;
        int left = 0;&lt;br /&gt;
        int min;&lt;br /&gt;
        int tmp;&lt;br /&gt;
&lt;br /&gt;
        while(left &amp;lt; n) {&lt;br /&gt;
            min = left;&lt;br /&gt;
            for(int i = left + 1; i&amp;lt;=n; i++) {&lt;br /&gt;
                if (list[i] &amp;lt; list[min]) {&lt;br /&gt;
                    min = i;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            tmp = list[min];&lt;br /&gt;
            list[min] = list[left];&lt;br /&gt;
            list[left] = tmp;&lt;br /&gt;
            left = left + 1;&lt;br /&gt;
        }&lt;br /&gt;
        return list;&lt;br /&gt;
    }	&lt;br /&gt;
    	&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Selection_sort&amp;diff=3344</id>
		<title>Selection sort</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Selection_sort&amp;diff=3344"/>
		<updated>2015-06-19T15:47:14Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Java Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Sorting Algorithms]]&lt;br /&gt;
&amp;lt;div class=&amp;quot;plainlinks&amp;quot; style=&amp;quot;float:right;margin:0 0 5px 5px; border:1px solid #AAAAAA; width:auto; padding:1em; margin: 0px 0px 1em 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.8em;font-weight:bold;text-align: center;margin:0.2em 0 1em 0&amp;quot;&amp;gt;Selection Sort&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.2em; margin:.5em 0 1em 0; text-align:center&amp;quot;&amp;gt;whatever&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.2em; margin:.5em 0 .5em 0;text-align:center&amp;quot;&amp;gt;[[File:olw_logo1.png|20px]][https://openlearnware.tu-darmstadt.de/#!/resource/selection-sort-1948 Openlearnware]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General information ==&lt;br /&gt;
&lt;br /&gt;
'''Algorithmic problem:''' [[Sorting based on pairwise comparison]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt;i \geq 0&amp;lt;/math&amp;gt; iterations: The elements at positions &amp;lt;math&amp;gt;|S|-i+1,\dots,|S|&amp;lt;/math&amp;gt; are correctly placed in sorting order.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;i = |S| - 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' Nothing to do.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Nothing to do.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' Identify the maximum out of &amp;lt;math&amp;gt;S[1],\dots,S[|S|-i+1]&amp;lt;/math&amp;gt; and then move it, by a swap, to position &amp;lt;math&amp;gt;|S|-i+1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m := 1&amp;lt;/math&amp;gt;&lt;br /&gt;
# For all &amp;lt;math&amp;gt;j=2,\dots,|S|-i+1&amp;lt;/math&amp;gt;: If &amp;lt;math&amp;gt;S[j] &amp;gt; S[m]&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;m := j&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Swap &amp;lt;math&amp;gt;S[m]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[|S|-i+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Obviously: &amp;lt;math&amp;gt;S[m]&amp;lt;/math&amp;gt; is the maximum element out of &amp;lt;math&amp;gt;S[1],\dots,S[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' The asymptotic complexity is in &amp;lt;math&amp;gt;\Theta(T\cdot n^2)&amp;lt;/math&amp;gt; in the best and worst case, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the complexity of the comparison.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The asymptotic complexity of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th iteration is in &amp;lt;math&amp;gt;\Theta(T\cdot(n - i))&amp;lt;/math&amp;gt;. Therefore, the total complexity is in &amp;lt;math&amp;gt;\Theta\left(T\cdot\sum_{i=1}^{n-1} (n-i) \right) = \Theta\left(T\cdot\sum_{i=1}^{n-1} i \right) = \Theta\left(T\cdot\frac{n(n-1)}{2} \right) = \Theta\left(T\cdot n^2\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
== Java Code ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	     	&lt;br /&gt;
     int[] selectionSort(int [] list) {&lt;br /&gt;
&lt;br /&gt;
        int n = list.length - 1;&lt;br /&gt;
        int left = 0;&lt;br /&gt;
        int min;&lt;br /&gt;
        int tmp;&lt;br /&gt;
&lt;br /&gt;
        while(left &amp;lt; n) {&lt;br /&gt;
            min = left;&lt;br /&gt;
            for(int i = left + 1; i&amp;lt;=n; i++) {&lt;br /&gt;
                if (list[i] &amp;lt; list[min]) {&lt;br /&gt;
                    min = i;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            tmp = list[min];&lt;br /&gt;
            list[min] = list[left];&lt;br /&gt;
            list[left] = tmp;&lt;br /&gt;
            left = left + 1;&lt;br /&gt;
        }&lt;br /&gt;
    }	&lt;br /&gt;
    	&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Selection_sort&amp;diff=3343</id>
		<title>Selection sort</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Selection_sort&amp;diff=3343"/>
		<updated>2015-06-19T15:46:53Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Java Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Sorting Algorithms]]&lt;br /&gt;
&amp;lt;div class=&amp;quot;plainlinks&amp;quot; style=&amp;quot;float:right;margin:0 0 5px 5px; border:1px solid #AAAAAA; width:auto; padding:1em; margin: 0px 0px 1em 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.8em;font-weight:bold;text-align: center;margin:0.2em 0 1em 0&amp;quot;&amp;gt;Selection Sort&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.2em; margin:.5em 0 1em 0; text-align:center&amp;quot;&amp;gt;whatever&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.2em; margin:.5em 0 .5em 0;text-align:center&amp;quot;&amp;gt;[[File:olw_logo1.png|20px]][https://openlearnware.tu-darmstadt.de/#!/resource/selection-sort-1948 Openlearnware]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General information ==&lt;br /&gt;
&lt;br /&gt;
'''Algorithmic problem:''' [[Sorting based on pairwise comparison]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt;i \geq 0&amp;lt;/math&amp;gt; iterations: The elements at positions &amp;lt;math&amp;gt;|S|-i+1,\dots,|S|&amp;lt;/math&amp;gt; are correctly placed in sorting order.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;i = |S| - 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' Nothing to do.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Nothing to do.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' Identify the maximum out of &amp;lt;math&amp;gt;S[1],\dots,S[|S|-i+1]&amp;lt;/math&amp;gt; and then move it, by a swap, to position &amp;lt;math&amp;gt;|S|-i+1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m := 1&amp;lt;/math&amp;gt;&lt;br /&gt;
# For all &amp;lt;math&amp;gt;j=2,\dots,|S|-i+1&amp;lt;/math&amp;gt;: If &amp;lt;math&amp;gt;S[j] &amp;gt; S[m]&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;m := j&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Swap &amp;lt;math&amp;gt;S[m]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[|S|-i+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Obviously: &amp;lt;math&amp;gt;S[m]&amp;lt;/math&amp;gt; is the maximum element out of &amp;lt;math&amp;gt;S[1],\dots,S[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' The asymptotic complexity is in &amp;lt;math&amp;gt;\Theta(T\cdot n^2)&amp;lt;/math&amp;gt; in the best and worst case, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the complexity of the comparison.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The asymptotic complexity of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th iteration is in &amp;lt;math&amp;gt;\Theta(T\cdot(n - i))&amp;lt;/math&amp;gt;. Therefore, the total complexity is in &amp;lt;math&amp;gt;\Theta\left(T\cdot\sum_{i=1}^{n-1} (n-i) \right) = \Theta\left(T\cdot\sum_{i=1}^{n-1} i \right) = \Theta\left(T\cdot\frac{n(n-1)}{2} \right) = \Theta\left(T\cdot n^2\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
== Java Code ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	     	&lt;br /&gt;
        int[] selectionSort(int [] list) {&lt;br /&gt;
&lt;br /&gt;
        int n = list.length - 1;&lt;br /&gt;
        int left = 0;&lt;br /&gt;
        int min;&lt;br /&gt;
        int tmp;&lt;br /&gt;
&lt;br /&gt;
        while(left &amp;lt; n) {&lt;br /&gt;
            min = left;&lt;br /&gt;
            for(int i = left + 1; i&amp;lt;=n; i++) {&lt;br /&gt;
                if (list[i] &amp;lt; list[min]) {&lt;br /&gt;
                    min = i;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            tmp = list[min];&lt;br /&gt;
            list[min] = list[left];&lt;br /&gt;
            list[left] = tmp;&lt;br /&gt;
            left = left + 1;&lt;br /&gt;
        }&lt;br /&gt;
    }	&lt;br /&gt;
    	&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Selection_sort&amp;diff=3342</id>
		<title>Selection sort</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Selection_sort&amp;diff=3342"/>
		<updated>2015-06-19T15:46:27Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Sorting Algorithms]]&lt;br /&gt;
&amp;lt;div class=&amp;quot;plainlinks&amp;quot; style=&amp;quot;float:right;margin:0 0 5px 5px; border:1px solid #AAAAAA; width:auto; padding:1em; margin: 0px 0px 1em 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.8em;font-weight:bold;text-align: center;margin:0.2em 0 1em 0&amp;quot;&amp;gt;Selection Sort&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.2em; margin:.5em 0 1em 0; text-align:center&amp;quot;&amp;gt;whatever&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 1.2em; margin:.5em 0 .5em 0;text-align:center&amp;quot;&amp;gt;[[File:olw_logo1.png|20px]][https://openlearnware.tu-darmstadt.de/#!/resource/selection-sort-1948 Openlearnware]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General information ==&lt;br /&gt;
&lt;br /&gt;
'''Algorithmic problem:''' [[Sorting based on pairwise comparison]]&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt;i \geq 0&amp;lt;/math&amp;gt; iterations: The elements at positions &amp;lt;math&amp;gt;|S|-i+1,\dots,|S|&amp;lt;/math&amp;gt; are correctly placed in sorting order.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' &amp;lt;math&amp;gt;i = |S| - 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Induction Basis ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' Nothing to do.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Nothing to do.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' Identify the maximum out of &amp;lt;math&amp;gt;S[1],\dots,S[|S|-i+1]&amp;lt;/math&amp;gt; and then move it, by a swap, to position &amp;lt;math&amp;gt;|S|-i+1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m := 1&amp;lt;/math&amp;gt;&lt;br /&gt;
# For all &amp;lt;math&amp;gt;j=2,\dots,|S|-i+1&amp;lt;/math&amp;gt;: If &amp;lt;math&amp;gt;S[j] &amp;gt; S[m]&amp;lt;/math&amp;gt; set &amp;lt;math&amp;gt;m := j&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Swap &amp;lt;math&amp;gt;S[m]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[|S|-i+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Obviously: &amp;lt;math&amp;gt;S[m]&amp;lt;/math&amp;gt; is the maximum element out of &amp;lt;math&amp;gt;S[1],\dots,S[j]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' The asymptotic complexity is in &amp;lt;math&amp;gt;\Theta(T\cdot n^2)&amp;lt;/math&amp;gt; in the best and worst case, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the complexity of the comparison.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The asymptotic complexity of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th iteration is in &amp;lt;math&amp;gt;\Theta(T\cdot(n - i))&amp;lt;/math&amp;gt;. Therefore, the total complexity is in &amp;lt;math&amp;gt;\Theta\left(T\cdot\sum_{i=1}^{n-1} (n-i) \right) = \Theta\left(T\cdot\sum_{i=1}^{n-1} i \right) = \Theta\left(T\cdot\frac{n(n-1)}{2} \right) = \Theta\left(T\cdot n^2\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
== Java Code ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
	     	&lt;br /&gt;
        int[] selectionSort(int [] list) {&lt;br /&gt;
&lt;br /&gt;
        int n = list.length - 1;&lt;br /&gt;
        int left = 0;&lt;br /&gt;
        int min;&lt;br /&gt;
        int tmp;&lt;br /&gt;
&lt;br /&gt;
        while(left &amp;lt; n) {&lt;br /&gt;
            min = left;&lt;br /&gt;
            for(int i = left + 1; i&amp;lt;=n; i++) {&lt;br /&gt;
                if (list[i] &amp;lt; list[min]) {&lt;br /&gt;
                    min = i;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            tmp = list[min];&lt;br /&gt;
            list[min] = list[left];&lt;br /&gt;
            list[left] = tmp;&lt;br /&gt;
            left = left + 1;&lt;br /&gt;
        }&lt;br /&gt;
    }	&lt;br /&gt;
    	&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_remove&amp;diff=2785</id>
		<title>Array list: remove</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_remove&amp;diff=2785"/>
		<updated>2015-01-27T15:13:28Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Induction step */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Algorithmic problem:''' [[Linear sequence: remove]]&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:''' A pointer &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; of type &amp;quot;pointer to array list item of type  &amp;lt;math&amp;gt;\mathcal{K}&amp;lt;/math&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Abstract view==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' After  &amp;lt;math&amp;gt;i \ge 0&amp;lt;/math&amp;gt;  iterations:&lt;br /&gt;
# The pointer  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the array list item at position  &amp;lt;math&amp;gt;i+1&amp;lt;/math&amp;gt; (or is void if no such item exists).&lt;br /&gt;
# None of the arrays at positions  &amp;lt;math&amp;gt;1,...,i+1&amp;lt;/math&amp;gt; contains  &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The pointer  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is moved one step forward to the next array list item.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' Either it is  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void or, otherwise, it is  &amp;lt;math&amp;gt;K=p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[j]&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;j \in \{1,...,p&amp;lt;/math&amp;gt;.next.n &amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Induction basis==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If the list is empty, the algorithm terminates. Otherwise, if the key to be removed is in the first array, it is removed and the algorithm terminates again (if this was the only element of the array, that array list item is removed as well).&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void, terminate the algorithm and return  &amp;lt;math&amp;gt;false&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, if  &amp;lt;math&amp;gt;K \in \{&amp;lt;/math&amp;gt;first.A &amp;lt;math&amp;gt;[1],...,&amp;lt;/math&amp;gt;first.A[first.n] &amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;:&lt;br /&gt;
## If first.n&amp;lt;math&amp;gt;n=1&amp;lt;/math&amp;gt;, set first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;first.next.&lt;br /&gt;
## Otherwise:&lt;br /&gt;
### Let &amp;lt;math&amp;gt;j \in\{1,...,&amp;lt;/math&amp;gt;first.n &amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt; such that first.A&amp;lt;math&amp;gt;[j]=K&amp;lt;/math&amp;gt;.&lt;br /&gt;
### For  &amp;lt;math&amp;gt;h=j,...,&amp;lt;/math&amp;gt;first.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt; (in this order): Set first.A &amp;lt;math&amp;gt;[h]:=&amp;lt;/math&amp;gt;first.A&amp;lt;math&amp;gt;[h+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### Set first.A&amp;lt;math&amp;gt;[&amp;lt;/math&amp;gt;first.n&amp;lt;math&amp;gt;]:=&amp;lt;/math&amp;gt;void.&lt;br /&gt;
### Set first.n:=first.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
## Terminate the algorithm and return  &amp;lt;math&amp;gt;true&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise (that is, &amp;lt;math&amp;gt;first /ne void&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;K \notin\{&amp;lt;/math&amp;gt;first.A &amp;lt;math&amp;gt;[1],...,first.a[first.n]\}&amp;lt;/math&amp;gt;), set  &amp;lt;math&amp;gt;p:=&amp;lt;/math&amp;gt;first.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void or &amp;lt;math&amp;gt;K \notin\{&amp;lt;/math&amp;gt;first.A&amp;lt;math&amp;gt;[1],...,&amp;lt;/math&amp;gt;first.A[first.n]&amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;, correctness is obvious. So consider the case that &amp;lt;math&amp;gt;first \ne void&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;K \in \{first.A[1],...,first.A[first.n]\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
If first.n&amp;lt;math&amp;gt;=1&amp;lt;/math&amp;gt;, the array would be empty after removing &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;, so the first list item is decoupled from the list in Step 2.1. Otherwise, &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt; is removed and the array is rearranged accordingly in Steps 2.2.2-2.2.4.&lt;br /&gt;
&lt;br /&gt;
==Induction step==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; has reached the end of the array list, the algorithm terminates. Otherwise, if the key to be removed is in the current array, it is removed and the algorithm terminates again (if this was the only element of the array, that array list item is removed as well).&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void, terminate the algorithm and return .&lt;br /&gt;
# Otherwise, if &amp;lt;math&amp;gt;K \in \{p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;,...,p&amp;lt;/math&amp;gt;.A.next.A[&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next.n]&amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;:&lt;br /&gt;
## If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next.n&amp;lt;math&amp;gt;=1&amp;lt;/math&amp;gt;, set .&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;next&amp;lt;math&amp;gt;p:=&amp;lt;/math&amp;gt;.next.next.&lt;br /&gt;
## Otherwise:&lt;br /&gt;
### Let &amp;lt;math&amp;gt;j \in \{1,...,p&amp;lt;/math&amp;gt;.next.n&amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next.A.&amp;lt;math&amp;gt;[j]=K&amp;lt;/math&amp;gt;.&lt;br /&gt;
### For &amp;lt;math&amp;gt;h=j,..,p&amp;lt;/math&amp;gt;.next.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt; (in this order): Set &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[h]:=p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[h+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### Set &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[p&amp;lt;/math&amp;gt;.next.n&amp;lt;math&amp;gt;]:=&amp;lt;/math&amp;gt;void.&lt;br /&gt;
### Set &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next.n&amp;lt;math&amp;gt;:=p&amp;lt;/math&amp;gt;.next.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
## Terminate the algorithm and return &amp;lt;math&amp;gt;true&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise (that is, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;\ne&amp;lt;/math&amp;gt;void and &amp;lt;math&amp;gt;K\notin\{p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[1],...,&amp;lt;/math&amp;gt;.next.A[p.next.n]&amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;), set  &amp;lt;math&amp;gt;p:=p&amp;lt;/math&amp;gt;.next.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void or &amp;lt;math&amp;gt;K\notin\{p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[1],...,p&amp;lt;/math&amp;gt;.next.A[first.n]&amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;, correctness is obvious. So consider the case that &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void and &amp;lt;math&amp;gt;K\in\{p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[1],...,p&amp;lt;/math&amp;gt;.next.A[&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;next.n]&amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next.n&amp;lt;math&amp;gt;=1&amp;lt;/math&amp;gt;, the array would be empty after removing &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;, so this list item is decoupled from the list in Step 2.1. Otherwise, it is removed and the array is rearranged accordingly in Steps 2.2.2-2.2.4.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' Linear in the length of the sequence in the worst case.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_remove&amp;diff=2784</id>
		<title>Array list: remove</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_remove&amp;diff=2784"/>
		<updated>2015-01-27T15:12:29Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Induction step */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Algorithmic problem:''' [[Linear sequence: remove]]&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:''' A pointer &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; of type &amp;quot;pointer to array list item of type  &amp;lt;math&amp;gt;\mathcal{K}&amp;lt;/math&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Abstract view==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' After  &amp;lt;math&amp;gt;i \ge 0&amp;lt;/math&amp;gt;  iterations:&lt;br /&gt;
# The pointer  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the array list item at position  &amp;lt;math&amp;gt;i+1&amp;lt;/math&amp;gt; (or is void if no such item exists).&lt;br /&gt;
# None of the arrays at positions  &amp;lt;math&amp;gt;1,...,i+1&amp;lt;/math&amp;gt; contains  &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The pointer  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is moved one step forward to the next array list item.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' Either it is  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void or, otherwise, it is  &amp;lt;math&amp;gt;K=p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[j]&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;j \in \{1,...,p&amp;lt;/math&amp;gt;.next.n &amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Induction basis==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If the list is empty, the algorithm terminates. Otherwise, if the key to be removed is in the first array, it is removed and the algorithm terminates again (if this was the only element of the array, that array list item is removed as well).&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void, terminate the algorithm and return  &amp;lt;math&amp;gt;false&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, if  &amp;lt;math&amp;gt;K \in \{&amp;lt;/math&amp;gt;first.A &amp;lt;math&amp;gt;[1],...,&amp;lt;/math&amp;gt;first.A[first.n] &amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;:&lt;br /&gt;
## If first.n&amp;lt;math&amp;gt;n=1&amp;lt;/math&amp;gt;, set first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;first.next.&lt;br /&gt;
## Otherwise:&lt;br /&gt;
### Let &amp;lt;math&amp;gt;j \in\{1,...,&amp;lt;/math&amp;gt;first.n &amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt; such that first.A&amp;lt;math&amp;gt;[j]=K&amp;lt;/math&amp;gt;.&lt;br /&gt;
### For  &amp;lt;math&amp;gt;h=j,...,&amp;lt;/math&amp;gt;first.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt; (in this order): Set first.A &amp;lt;math&amp;gt;[h]:=&amp;lt;/math&amp;gt;first.A&amp;lt;math&amp;gt;[h+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### Set first.A&amp;lt;math&amp;gt;[&amp;lt;/math&amp;gt;first.n&amp;lt;math&amp;gt;]:=&amp;lt;/math&amp;gt;void.&lt;br /&gt;
### Set first.n:=first.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
## Terminate the algorithm and return  &amp;lt;math&amp;gt;true&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise (that is, &amp;lt;math&amp;gt;first /ne void&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;K \notin\{&amp;lt;/math&amp;gt;first.A &amp;lt;math&amp;gt;[1],...,first.a[first.n]\}&amp;lt;/math&amp;gt;), set  &amp;lt;math&amp;gt;p:=&amp;lt;/math&amp;gt;first.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void or &amp;lt;math&amp;gt;K \notin\{&amp;lt;/math&amp;gt;first.A&amp;lt;math&amp;gt;[1],...,&amp;lt;/math&amp;gt;first.A[first.n]&amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;, correctness is obvious. So consider the case that &amp;lt;math&amp;gt;first \ne void&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;K \in \{first.A[1],...,first.A[first.n]\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
If first.n&amp;lt;math&amp;gt;=1&amp;lt;/math&amp;gt;, the array would be empty after removing &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;, so the first list item is decoupled from the list in Step 2.1. Otherwise, &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt; is removed and the array is rearranged accordingly in Steps 2.2.2-2.2.4.&lt;br /&gt;
&lt;br /&gt;
==Induction step==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; has reached the end of the array list, the algorithm terminates. Otherwise, if the key to be removed is in the current array, it is removed and the algorithm terminates again (if this was the only element of the array, that array list item is removed as well).&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void, terminate the algorithm and return .&lt;br /&gt;
# Otherwise, if &amp;lt;math&amp;gt;K \in \{p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;,...,p&amp;lt;/math&amp;gt;.A.next.A[&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next.n]&amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;:&lt;br /&gt;
## If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next.n&amp;lt;math&amp;gt;=1&amp;lt;/math&amp;gt;, set .&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;next&amp;lt;math&amp;gt;p:=&amp;lt;/math&amp;gt;.next.next.&lt;br /&gt;
## Otherwise:&lt;br /&gt;
### Let &amp;lt;math&amp;gt;j \in \{1,...,p&amp;lt;/math&amp;gt;.next.n&amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next.A.&amp;lt;math&amp;gt;[j]=K&amp;lt;/math&amp;gt;.&lt;br /&gt;
### For &amp;lt;math&amp;gt;h=j,..,p&amp;lt;/math&amp;gt;.next.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt; (in this order): Set &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[h]:=p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[h+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### Set &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[p&amp;lt;/math&amp;gt;.next.n&amp;lt;math&amp;gt;]:=&amp;lt;/math&amp;gt;void.&lt;br /&gt;
### Set &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next.n&amp;lt;math&amp;gt;:=p&amp;lt;/math&amp;gt;.next.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
## Terminate the algorithm and return &amp;lt;math&amp;gt;true&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise (that is, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;\ne&amp;lt;/math&amp;gt;void and &amp;lt;math&amp;gt;K\notin\{p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[1],...,&amp;lt;/math&amp;gt;.next.A[p.next.n]&amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;), set  &amp;lt;math&amp;gt;p:=p&amp;lt;/math&amp;gt;.next.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void or &amp;lt;math&amp;gt;K\notin\{p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[1],...,p&amp;lt;/math&amp;gt;.next.A[first.n]&amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;, correctness is obvious. So consider the case that &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void and &amp;lt;math&amp;gt;K\in\{p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[1],...,p&amp;lt;/math&amp;gt;.next.A[&amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;first.n]&amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next.n&amp;lt;math&amp;gt;=1&amp;lt;/math&amp;gt;, the array would be empty after removing &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;, so this list item is decoupled from the list in Step 2.1. Otherwise, it is removed and the array is rearranged accordingly in Steps 2.2.2-2.2.4.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' Linear in the length of the sequence in the worst case.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_remove&amp;diff=2783</id>
		<title>Array list: remove</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_remove&amp;diff=2783"/>
		<updated>2015-01-27T14:46:03Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Induction basis */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Algorithmic problem:''' [[Linear sequence: remove]]&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:''' A pointer &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; of type &amp;quot;pointer to array list item of type  &amp;lt;math&amp;gt;\mathcal{K}&amp;lt;/math&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Abstract view==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' After  &amp;lt;math&amp;gt;i \ge 0&amp;lt;/math&amp;gt;  iterations:&lt;br /&gt;
# The pointer  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the array list item at position  &amp;lt;math&amp;gt;i+1&amp;lt;/math&amp;gt; (or is void if no such item exists).&lt;br /&gt;
# None of the arrays at positions  &amp;lt;math&amp;gt;1,...,i+1&amp;lt;/math&amp;gt; contains  &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The pointer  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is moved one step forward to the next array list item.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' Either it is  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void or, otherwise, it is  &amp;lt;math&amp;gt;K=p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[j]&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;j \in \{1,...,p&amp;lt;/math&amp;gt;.next.n &amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Induction basis==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If the list is empty, the algorithm terminates. Otherwise, if the key to be removed is in the first array, it is removed and the algorithm terminates again (if this was the only element of the array, that array list item is removed as well).&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void, terminate the algorithm and return  &amp;lt;math&amp;gt;false&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, if  &amp;lt;math&amp;gt;K \in \{&amp;lt;/math&amp;gt;first.A &amp;lt;math&amp;gt;[1],...,&amp;lt;/math&amp;gt;first.A[first.n] &amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;:&lt;br /&gt;
## If first.n&amp;lt;math&amp;gt;n=1&amp;lt;/math&amp;gt;, set first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;first.next.&lt;br /&gt;
## Otherwise:&lt;br /&gt;
### Let &amp;lt;math&amp;gt;j \in\{1,...,&amp;lt;/math&amp;gt;first.n &amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt; such that first.A&amp;lt;math&amp;gt;[j]=K&amp;lt;/math&amp;gt;.&lt;br /&gt;
### For  &amp;lt;math&amp;gt;h=j,...,&amp;lt;/math&amp;gt;first.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt; (in this order): Set first.A &amp;lt;math&amp;gt;[h]:=&amp;lt;/math&amp;gt;first.A&amp;lt;math&amp;gt;[h+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### Set first.A&amp;lt;math&amp;gt;[&amp;lt;/math&amp;gt;first.n&amp;lt;math&amp;gt;]:=&amp;lt;/math&amp;gt;void.&lt;br /&gt;
### Set first.n:=first.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
## Terminate the algorithm and return  &amp;lt;math&amp;gt;true&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise (that is, &amp;lt;math&amp;gt;first /ne void&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;K \notin\{&amp;lt;/math&amp;gt;first.A &amp;lt;math&amp;gt;[1],...,first.a[first.n]\}&amp;lt;/math&amp;gt;), set  &amp;lt;math&amp;gt;p:=&amp;lt;/math&amp;gt;first.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void or &amp;lt;math&amp;gt;K \notin\{&amp;lt;/math&amp;gt;first.A&amp;lt;math&amp;gt;[1],...,&amp;lt;/math&amp;gt;first.A[first.n]&amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;, correctness is obvious. So consider the case that &amp;lt;math&amp;gt;first \ne void&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;K \in \{first.A[1],...,first.A[first.n]\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
If first.n&amp;lt;math&amp;gt;=1&amp;lt;/math&amp;gt;, the array would be empty after removing &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;, so the first list item is decoupled from the list in Step 2.1. Otherwise, &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt; is removed and the array is rearranged accordingly in Steps 2.2.2-2.2.4.&lt;br /&gt;
&lt;br /&gt;
==Induction step==&lt;br /&gt;
&lt;br /&gt;
Abstract view: If  has reached the end of the array list, the algorithm terminates. Otherwise, if the key to be removed is in the current array, it is removed and the algorithm terminates again (if this was the only element of the array, that array list item is removed as well).&lt;br /&gt;
Implementation:&lt;br /&gt;
If .nextvoid, terminate the algorithm and return .&lt;br /&gt;
Otherwise, if .next.A.next.A[.next.n]:&lt;br /&gt;
If .next.n, set .next.next.next.&lt;br /&gt;
Otherwise:&lt;br /&gt;
Let .next.n such that .next.A.&lt;br /&gt;
For .next.n (in this order): Set .next.A.next.A.&lt;br /&gt;
Set .next.A.next.nvoid.&lt;br /&gt;
Set .next.n.next.n.&lt;br /&gt;
Terminate the algorithm and return .&lt;br /&gt;
Otherwise (that is, .nextvoid and .next.A.next.A[p.next.n]), set .next.&lt;br /&gt;
Correctness: If .nextvoid or .next.A.next.A[first.n], correctness is obvious. So consider the case that .nextvoid and .next.A.next.A[.next.n]. &lt;br /&gt;
If .next.n, the array would be empty after removing , so this list item is decoupled from the list in Step 2.1. Otherwise, it is removed and the array is rearranged accordingly in Steps 2.2.2-2.2.4.&lt;br /&gt;
&lt;br /&gt;
Complexity&lt;br /&gt;
&lt;br /&gt;
Statement: Linear in the length of the sequence in the worst case.&lt;br /&gt;
Proof: Obvious.&lt;br /&gt;
&lt;br /&gt;
Further information&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_remove&amp;diff=2782</id>
		<title>Array list: remove</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_remove&amp;diff=2782"/>
		<updated>2015-01-27T14:42:50Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Induction basis */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Algorithmic problem:''' [[Linear sequence: remove]]&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:''' A pointer &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; of type &amp;quot;pointer to array list item of type  &amp;lt;math&amp;gt;\mathcal{K}&amp;lt;/math&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Abstract view==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' After  &amp;lt;math&amp;gt;i \ge 0&amp;lt;/math&amp;gt;  iterations:&lt;br /&gt;
# The pointer  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the array list item at position  &amp;lt;math&amp;gt;i+1&amp;lt;/math&amp;gt; (or is void if no such item exists).&lt;br /&gt;
# None of the arrays at positions  &amp;lt;math&amp;gt;1,...,i+1&amp;lt;/math&amp;gt; contains  &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The pointer  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is moved one step forward to the next array list item.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' Either it is  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void or, otherwise, it is  &amp;lt;math&amp;gt;K=p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[j]&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;j \in \{1,...,p&amp;lt;/math&amp;gt;.next.n &amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Induction basis==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If the list is empty, the algorithm terminates. Otherwise, if the key to be removed is in the first array, it is removed and the algorithm terminates again (if this was the only element of the array, that array list item is removed as well).&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void, terminate the algorithm and return  &amp;lt;math&amp;gt;false&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, if  &amp;lt;math&amp;gt;K \in {&amp;lt;/math&amp;gt;first.A &amp;lt;math&amp;gt;[1],...,&amp;lt;/math&amp;gt;first.A[first.n] &amp;lt;math&amp;gt;}&amp;lt;/math&amp;gt;:&lt;br /&gt;
## If first.n&amp;lt;math&amp;gt;n=1&amp;lt;/math&amp;gt;, set first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;first.next.&lt;br /&gt;
## Otherwise:&lt;br /&gt;
### Let &amp;lt;math&amp;gt;j \in\{1,...,&amp;lt;/math&amp;gt;first.n &amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt; such that first.A&amp;lt;math&amp;gt;[j]=K&amp;lt;/math&amp;gt;.&lt;br /&gt;
### For  &amp;lt;math&amp;gt;h=j,...,&amp;lt;/math&amp;gt;first.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt; (in this order): Set first.A &amp;lt;math&amp;gt;[h]:=&amp;lt;/math&amp;gt;first.A&amp;lt;math&amp;gt;[h+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### Set first.A&amp;lt;math&amp;gt;[&amp;lt;/math&amp;gt;first.n&amp;lt;math&amp;gt;]:=&amp;lt;/math&amp;gt;void.&lt;br /&gt;
### Set first.n:=first.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
## Terminate the algorithm and return  &amp;lt;math&amp;gt;true&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise (that is, &amp;lt;math&amp;gt;first /ne void&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;K \notin\{&amp;lt;/math&amp;gt;first.A &amp;lt;math&amp;gt;[1],...,first.a[first.n]\}&amp;lt;/math&amp;gt;), set  &amp;lt;math&amp;gt;p:=&amp;lt;/math&amp;gt;first.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void or &amp;lt;math&amp;gt;K \notin\{&amp;lt;/math&amp;gt;first.A&amp;lt;math&amp;gt;[1],...,&amp;lt;/math&amp;gt;first.A[first.n]&amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;, correctness is obvious. So consider the case that &amp;lt;math&amp;gt;first \ne void&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;K \in {first.A[1],...,first.A[first.n]&amp;lt;/math&amp;gt;. &lt;br /&gt;
If first.n&amp;lt;math&amp;gt;=1&amp;lt;/math&amp;gt;, the array would be empty after removing &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;, so the first list item is decoupled from the list in Step 2.1. Otherwise, &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt; is removed and the array is rearranged accordingly in Steps 2.2.2-2.2.4.&lt;br /&gt;
&lt;br /&gt;
==Induction step==&lt;br /&gt;
&lt;br /&gt;
Abstract view: If  has reached the end of the array list, the algorithm terminates. Otherwise, if the key to be removed is in the current array, it is removed and the algorithm terminates again (if this was the only element of the array, that array list item is removed as well).&lt;br /&gt;
Implementation:&lt;br /&gt;
If .nextvoid, terminate the algorithm and return .&lt;br /&gt;
Otherwise, if .next.A.next.A[.next.n]:&lt;br /&gt;
If .next.n, set .next.next.next.&lt;br /&gt;
Otherwise:&lt;br /&gt;
Let .next.n such that .next.A.&lt;br /&gt;
For .next.n (in this order): Set .next.A.next.A.&lt;br /&gt;
Set .next.A.next.nvoid.&lt;br /&gt;
Set .next.n.next.n.&lt;br /&gt;
Terminate the algorithm and return .&lt;br /&gt;
Otherwise (that is, .nextvoid and .next.A.next.A[p.next.n]), set .next.&lt;br /&gt;
Correctness: If .nextvoid or .next.A.next.A[first.n], correctness is obvious. So consider the case that .nextvoid and .next.A.next.A[.next.n]. &lt;br /&gt;
If .next.n, the array would be empty after removing , so this list item is decoupled from the list in Step 2.1. Otherwise, it is removed and the array is rearranged accordingly in Steps 2.2.2-2.2.4.&lt;br /&gt;
&lt;br /&gt;
Complexity&lt;br /&gt;
&lt;br /&gt;
Statement: Linear in the length of the sequence in the worst case.&lt;br /&gt;
Proof: Obvious.&lt;br /&gt;
&lt;br /&gt;
Further information&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_remove&amp;diff=2781</id>
		<title>Array list: remove</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_remove&amp;diff=2781"/>
		<updated>2015-01-27T14:41:23Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Abstract view */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Algorithmic problem:''' [[Linear sequence: remove]]&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:''' A pointer &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; of type &amp;quot;pointer to array list item of type  &amp;lt;math&amp;gt;\mathcal{K}&amp;lt;/math&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Abstract view==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' After  &amp;lt;math&amp;gt;i \ge 0&amp;lt;/math&amp;gt;  iterations:&lt;br /&gt;
# The pointer  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the array list item at position  &amp;lt;math&amp;gt;i+1&amp;lt;/math&amp;gt; (or is void if no such item exists).&lt;br /&gt;
# None of the arrays at positions  &amp;lt;math&amp;gt;1,...,i+1&amp;lt;/math&amp;gt; contains  &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The pointer  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is moved one step forward to the next array list item.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' Either it is  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void or, otherwise, it is  &amp;lt;math&amp;gt;K=p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;[j]&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;j \in \{1,...,p&amp;lt;/math&amp;gt;.next.n &amp;lt;math&amp;gt;\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Induction basis==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If the list is empty, the algorithm terminates. Otherwise, if the key to be removed is in the first array, it is removed and the algorithm terminates again (if this was the only element of the array, that array list item is removed as well).&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void, terminate the algorithm and return  &amp;lt;math&amp;gt;false&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, if  &amp;lt;math&amp;gt;K \in {&amp;lt;/math&amp;gt;first.A &amp;lt;math&amp;gt;[1],...,&amp;lt;/math&amp;gt;first.A[first.n] &amp;lt;math&amp;gt;}&amp;lt;/math&amp;gt;:&lt;br /&gt;
## If first.n&amp;lt;math&amp;gt;n=1&amp;lt;/math&amp;gt;, set first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;first.next.&lt;br /&gt;
## Otherwise:&lt;br /&gt;
### Let &amp;lt;math&amp;gt;j \in{1,...,&amp;lt;/math&amp;gt;first.n &amp;lt;math&amp;gt;}&amp;lt;/math&amp;gt; such that first.A&amp;lt;math&amp;gt;[j]=K&amp;lt;/math&amp;gt;.&lt;br /&gt;
### For  &amp;lt;math&amp;gt;h=j,...,&amp;lt;/math&amp;gt;first.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt; (in this order): Set first.A &amp;lt;math&amp;gt;[h]:=&amp;lt;/math&amp;gt;first.A&amp;lt;math&amp;gt;[h+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### Set first.A&amp;lt;math&amp;gt;[&amp;lt;/math&amp;gt;first.n&amp;lt;math&amp;gt;]:=&amp;lt;/math&amp;gt;void.&lt;br /&gt;
### Set first.n:=first.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
## Terminate the algorithm and return  &amp;lt;math&amp;gt;true&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise (that is, &amp;lt;math&amp;gt;first /ne void&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;K \notin{&amp;lt;/math&amp;gt;first.A &amp;lt;math&amp;gt;[1],...,first.a[first.n]}&amp;lt;/math&amp;gt;), set  &amp;lt;math&amp;gt;p:=&amp;lt;/math&amp;gt;first.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void or &amp;lt;math&amp;gt;K \notin{&amp;lt;/math&amp;gt;first.A&amp;lt;math&amp;gt;[1],...,&amp;lt;/math&amp;gt;first.A[first.n]&amp;lt;math&amp;gt;}&amp;lt;/math&amp;gt;, correctness is obvious. So consider the case that &amp;lt;math&amp;gt;first \ne void&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;K \in {first.A[1],...,first.A[first.n]&amp;lt;/math&amp;gt;. &lt;br /&gt;
If first.n&amp;lt;math&amp;gt;=1&amp;lt;/math&amp;gt;, the array would be empty after removing &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;, so the first list item is decoupled from the list in Step 2.1. Otherwise, &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt; is removed and the array is rearranged accordingly in Steps 2.2.2-2.2.4.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Induction step==&lt;br /&gt;
&lt;br /&gt;
Abstract view: If  has reached the end of the array list, the algorithm terminates. Otherwise, if the key to be removed is in the current array, it is removed and the algorithm terminates again (if this was the only element of the array, that array list item is removed as well).&lt;br /&gt;
Implementation:&lt;br /&gt;
If .nextvoid, terminate the algorithm and return .&lt;br /&gt;
Otherwise, if .next.A.next.A[.next.n]:&lt;br /&gt;
If .next.n, set .next.next.next.&lt;br /&gt;
Otherwise:&lt;br /&gt;
Let .next.n such that .next.A.&lt;br /&gt;
For .next.n (in this order): Set .next.A.next.A.&lt;br /&gt;
Set .next.A.next.nvoid.&lt;br /&gt;
Set .next.n.next.n.&lt;br /&gt;
Terminate the algorithm and return .&lt;br /&gt;
Otherwise (that is, .nextvoid and .next.A.next.A[p.next.n]), set .next.&lt;br /&gt;
Correctness: If .nextvoid or .next.A.next.A[first.n], correctness is obvious. So consider the case that .nextvoid and .next.A.next.A[.next.n]. &lt;br /&gt;
If .next.n, the array would be empty after removing , so this list item is decoupled from the list in Step 2.1. Otherwise, it is removed and the array is rearranged accordingly in Steps 2.2.2-2.2.4.&lt;br /&gt;
&lt;br /&gt;
Complexity&lt;br /&gt;
&lt;br /&gt;
Statement: Linear in the length of the sequence in the worst case.&lt;br /&gt;
Proof: Obvious.&lt;br /&gt;
&lt;br /&gt;
Further information&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_remove&amp;diff=2780</id>
		<title>Array list: remove</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_remove&amp;diff=2780"/>
		<updated>2015-01-27T14:34:41Z</updated>

		<summary type="html">&lt;p&gt;JanR: Created page with &amp;quot;'''Algorithmic problem:''' Linear sequence: remove  '''Prerequisites:'''  '''Type of algorithm:''' loop  '''Auxiliary data:''' A pointer &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; of type &amp;quot;pointer to...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Algorithmic problem:''' [[Linear sequence: remove]]&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:''' A pointer &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; of type &amp;quot;pointer to array list item of type  &amp;lt;math&amp;gt;\mathcal{K}&amp;lt;/math&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Abstract view==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' After  &amp;lt;math&amp;gt;i \ge 0&amp;lt;/math&amp;gt;  iterations:&lt;br /&gt;
# The pointer  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the array list item at position  &amp;lt;math&amp;gt;i+1&amp;lt;/math&amp;gt; (or is void if no such item exists).&lt;br /&gt;
# None of the arrays at positions  &amp;lt;math&amp;gt;1,...,i+1&amp;lt;/math&amp;gt; contains  &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' The pointer  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is moved one step forward to the next array list item.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' Either it is  &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.next&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void or, otherwise, it is  &amp;lt;math&amp;gt;K=p&amp;lt;/math&amp;gt;.next.A&amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; for some &amp;lt;math&amp;gt;j \in {1,...,p&amp;lt;/math&amp;gt;.next.n &amp;lt;math&amp;gt;}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Induction basis==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If the list is empty, the algorithm terminates. Otherwise, if the key to be removed is in the first array, it is removed and the algorithm terminates again (if this was the only element of the array, that array list item is removed as well).&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void, terminate the algorithm and return  &amp;lt;math&amp;gt;false&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, if  &amp;lt;math&amp;gt;K \in {&amp;lt;/math&amp;gt;first.A &amp;lt;math&amp;gt;[1],...,&amp;lt;/math&amp;gt;first.A[first.n] &amp;lt;math&amp;gt;}&amp;lt;/math&amp;gt;:&lt;br /&gt;
## If first.n&amp;lt;math&amp;gt;n=1&amp;lt;/math&amp;gt;, set first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;first.next.&lt;br /&gt;
## Otherwise:&lt;br /&gt;
### Let &amp;lt;math&amp;gt;j \in{1,...,&amp;lt;/math&amp;gt;first.n &amp;lt;math&amp;gt;}&amp;lt;/math&amp;gt; such that first.A&amp;lt;math&amp;gt;[j]=K&amp;lt;/math&amp;gt;.&lt;br /&gt;
### For  &amp;lt;math&amp;gt;h=j,...,&amp;lt;/math&amp;gt;first.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt; (in this order): Set first.A &amp;lt;math&amp;gt;[h]:=&amp;lt;/math&amp;gt;first.A&amp;lt;math&amp;gt;[h+1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### Set first.A&amp;lt;math&amp;gt;[&amp;lt;/math&amp;gt;first.n&amp;lt;math&amp;gt;]:=&amp;lt;/math&amp;gt;void.&lt;br /&gt;
### Set first.n:=first.n&amp;lt;math&amp;gt;-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
## Terminate the algorithm and return  &amp;lt;math&amp;gt;true&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise (that is, &amp;lt;math&amp;gt;first /ne void&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;K \notin{&amp;lt;/math&amp;gt;first.A &amp;lt;math&amp;gt;[1],...,first.a[first.n]}&amp;lt;/math&amp;gt;), set  &amp;lt;math&amp;gt;p:=&amp;lt;/math&amp;gt;first.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.first&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;void or &amp;lt;math&amp;gt;K \notin{&amp;lt;/math&amp;gt;first.A&amp;lt;math&amp;gt;[1],...,&amp;lt;/math&amp;gt;first.A[first.n]&amp;lt;math&amp;gt;}&amp;lt;/math&amp;gt;, correctness is obvious. So consider the case that &amp;lt;math&amp;gt;first \ne void&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;K \in {first.A[1],...,first.A[first.n]&amp;lt;/math&amp;gt;. &lt;br /&gt;
If first.n&amp;lt;math&amp;gt;=1&amp;lt;/math&amp;gt;, the array would be empty after removing &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;, so the first list item is decoupled from the list in Step 2.1. Otherwise, &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt; is removed and the array is rearranged accordingly in Steps 2.2.2-2.2.4.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Induction step==&lt;br /&gt;
&lt;br /&gt;
Abstract view: If  has reached the end of the array list, the algorithm terminates. Otherwise, if the key to be removed is in the current array, it is removed and the algorithm terminates again (if this was the only element of the array, that array list item is removed as well).&lt;br /&gt;
Implementation:&lt;br /&gt;
If .nextvoid, terminate the algorithm and return .&lt;br /&gt;
Otherwise, if .next.A.next.A[.next.n]:&lt;br /&gt;
If .next.n, set .next.next.next.&lt;br /&gt;
Otherwise:&lt;br /&gt;
Let .next.n such that .next.A.&lt;br /&gt;
For .next.n (in this order): Set .next.A.next.A.&lt;br /&gt;
Set .next.A.next.nvoid.&lt;br /&gt;
Set .next.n.next.n.&lt;br /&gt;
Terminate the algorithm and return .&lt;br /&gt;
Otherwise (that is, .nextvoid and .next.A.next.A[p.next.n]), set .next.&lt;br /&gt;
Correctness: If .nextvoid or .next.A.next.A[first.n], correctness is obvious. So consider the case that .nextvoid and .next.A.next.A[.next.n]. &lt;br /&gt;
If .next.n, the array would be empty after removing , so this list item is decoupled from the list in Step 2.1. Otherwise, it is removed and the array is rearranged accordingly in Steps 2.2.2-2.2.4.&lt;br /&gt;
&lt;br /&gt;
Complexity&lt;br /&gt;
&lt;br /&gt;
Statement: Linear in the length of the sequence in the worst case.&lt;br /&gt;
Proof: Obvious.&lt;br /&gt;
&lt;br /&gt;
Further information&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_number&amp;diff=2779</id>
		<title>Array list: number</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_number&amp;diff=2779"/>
		<updated>2015-01-27T14:00:14Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Algorithmic problem:''' [[Linear sequence: number]]&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;
&lt;br /&gt;
# A pointer &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; of type &amp;quot;pointer to array list item of type &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;&amp;quot;.&lt;br /&gt;
# A counter &amp;lt;math&amp;gt;c \in \mathbb{N}_0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt;i \ge 0&amp;lt;/math&amp;gt; iterations:&lt;br /&gt;
&lt;br /&gt;
# The pointer &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; points to the array list item at position &amp;lt;math&amp;gt;i+1&amp;lt;/math&amp;gt; (or is void if there is no such item).&lt;br /&gt;
#The value of  is the sum of the values n of all array list items at positions &amp;lt;math&amp;gt;1,...,i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is moved one step forward so as to point to the next array list item.&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;p=&amp;lt;/math&amp;gt; void.&lt;br /&gt;
&lt;br /&gt;
==Induction basis==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' Initialize &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; so as to point to the first array list item.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
# Set &amp;lt;math&amp;gt;p:=first&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;c:=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
==Induction step==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' Add the number of elements in the current array and then go forward.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# If void, terminate the algorithm and return the value of &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise:&lt;br /&gt;
## Set &amp;lt;math&amp;gt;c:=c+p&amp;lt;/math&amp;gt;.n.&lt;br /&gt;
## Set &amp;lt;math&amp;gt;p:=p&amp;lt;/math&amp;gt;.next.&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
==Complexity==&lt;br /&gt;
&lt;br /&gt;
'''Statement:''' Linear in the length of the sequence in the worst case (for a fixed value of ).&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_number&amp;diff=2778</id>
		<title>Array list: number</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Array_list:_number&amp;diff=2778"/>
		<updated>2015-01-27T13:52:30Z</updated>

		<summary type="html">&lt;p&gt;JanR: Created page with &amp;quot;'''Algorithmic problem:''' Linear sequence: number  '''Prerequisites:'''  '''Type of algorithm:''' loop  '''Auxiliary data:'''  # A pointer &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; of type &amp;quot;pointer...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Algorithmic problem:''' [[Linear sequence: number]]&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;
&lt;br /&gt;
# A pointer &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; of type &amp;quot;pointer to array list item of type &amp;lt;math&amp;gt;K&amp;lt;/math&amp;gt;&amp;quot;.&lt;br /&gt;
# A counter &amp;lt;math&amp;gt;c \in \mathbb{N}_0&amp;lt;/math&amp;gt;.&lt;br /&gt;
Abstract view&lt;br /&gt;
&lt;br /&gt;
Invariant: After  iterations:&lt;br /&gt;
The pointer  points to the array list item at position  (or is void if there is no such item).&lt;br /&gt;
The value of  is the sum of the values n of all array list items at positions .&lt;br /&gt;
Variant:   is moved one step forward so as to point to the next array list item.&lt;br /&gt;
Break condition: It is void.&lt;br /&gt;
&lt;br /&gt;
Induction basis&lt;br /&gt;
&lt;br /&gt;
Abstract view: Initialize  so as to point to the first array list item.&lt;br /&gt;
Implementation:&lt;br /&gt;
Set first.&lt;br /&gt;
Set .&lt;br /&gt;
Proof: Nothing to show.&lt;br /&gt;
&lt;br /&gt;
Induction step&lt;br /&gt;
&lt;br /&gt;
Abstract view: Add the number of elements in the current array and then go forward.&lt;br /&gt;
Implementation:&lt;br /&gt;
If void, terminate the algorithm and return the value of .&lt;br /&gt;
Otherwise:&lt;br /&gt;
Set .n.&lt;br /&gt;
Set .next.&lt;br /&gt;
Correctness: Nothing to show.&lt;br /&gt;
&lt;br /&gt;
Complexity&lt;br /&gt;
&lt;br /&gt;
Statement: Linear in the length of the sequence in the worst case (for a fixed value of ).&lt;br /&gt;
Proof: Obvious.&lt;br /&gt;
&lt;br /&gt;
Further information&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2777</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2777"/>
		<updated>2015-01-27T13:38:33Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
'''Algorithmic Problem:''' [[Matchings in graphs]].&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is [[Bipartite graph|bipartite]].&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is initialized to be some matching, for example,  &amp;lt;math&amp;gt;M:=\empty&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If there is an augmenting alternating path, use it to increase &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;; otherwise, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Call the algorithm Find augmenting alternating path.&lt;br /&gt;
# If this call fails, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, let &amp;lt;math&amp;gt;E'&amp;lt;/math&amp;gt; denote the set of all edges on the path delivered by that call.&lt;br /&gt;
# Let &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; be the [http://en.wikipedia.org/wiki/Symmetric_difference symmetric difference] of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;???&amp;lt;/math&amp;gt; &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
 &lt;br /&gt;
'''Statement:'''&lt;br /&gt;
&lt;br /&gt;
'''Proof:'''&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2776</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2776"/>
		<updated>2015-01-27T13:25:59Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
'''Algorithmic Problem:''' [[Maximum matching problem]].&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is [[Bipartite graph|bipartite]].&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is initialized to be some matching, for example,  &amp;lt;math&amp;gt;M:=\empty&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If there is an augmenting alternating path, use it to increase &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;; otherwise, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Call the algorithm Find augmenting alternating path.&lt;br /&gt;
# If this call fails, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, let &amp;lt;math&amp;gt;E'&amp;lt;/math&amp;gt; denote the set of all edges on the path delivered by that call.&lt;br /&gt;
# Let &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; be the [http://en.wikipedia.org/wiki/Symmetric_difference symmetric difference] of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;???&amp;lt;/math&amp;gt; &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
 &lt;br /&gt;
'''Statement:'''&lt;br /&gt;
&lt;br /&gt;
'''Proof:'''&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2775</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2775"/>
		<updated>2015-01-27T13:21:21Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
'''Algorithmic Problem:''' [http://wiki.algo.informatik.tu-darmstadt.de/index.php/Matchings_in_graphs#Cardinality-maximal_matching\ Maximum matching problem]&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is [http://wiki.algo.informatik.tu-darmstadt.de/index.php/Bipartite_graph\ bipartite].&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is initialized to be some matching, for example,  &amp;lt;math&amp;gt;M:=\empty&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If there is an augmenting alternating path, use it to increase &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;; otherwise, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Call the algorithm Find augmenting alternating path.&lt;br /&gt;
# If this call fails, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, let &amp;lt;math&amp;gt;E'&amp;lt;/math&amp;gt; denote the set of all edges on the path delivered by that call.&lt;br /&gt;
# Let &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; be the [http://en.wikipedia.org/wiki/Symmetric_difference symmetric difference] of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;???&amp;lt;/math&amp;gt; &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
 &lt;br /&gt;
'''Statement:'''&lt;br /&gt;
&lt;br /&gt;
'''Proof:'''&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2774</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2774"/>
		<updated>2015-01-27T13:21:09Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
'''Algorithmic Problem:''' [http://wiki.algo.informatik.tu-darmstadt.de/index.php/Matchings_in_graphs#Cardinality-maximal_matching\ Maximum matching problem]&lt;br /&gt;
'''Prerequisites:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is [http://wiki.algo.informatik.tu-darmstadt.de/index.php/Bipartite_graph\ bipartite].&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is initialized to be some matching, for example,  &amp;lt;math&amp;gt;M:=\empty&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If there is an augmenting alternating path, use it to increase &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;; otherwise, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Call the algorithm Find augmenting alternating path.&lt;br /&gt;
# If this call fails, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, let &amp;lt;math&amp;gt;E'&amp;lt;/math&amp;gt; denote the set of all edges on the path delivered by that call.&lt;br /&gt;
# Let &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; be the [http://en.wikipedia.org/wiki/Symmetric_difference symmetric difference] of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;???&amp;lt;/math&amp;gt; &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
 &lt;br /&gt;
'''Statement:'''&lt;br /&gt;
&lt;br /&gt;
'''Proof:'''&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2773</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2773"/>
		<updated>2015-01-27T13:18:15Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithmic problem:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is biparite.&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is initialized to be some matching, for example,  &amp;lt;math&amp;gt;M:=\empty&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If there is an augmenting alternating path, use it to increase &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;; otherwise, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Call the algorithm Find augmenting alternating path.&lt;br /&gt;
# If this call fails, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, let &amp;lt;math&amp;gt;E'&amp;lt;/math&amp;gt; denote the set of all edges on the path delivered by that call.&lt;br /&gt;
# Let &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; be the [http://en.wikipedia.org/wiki/Symmetric_difference symmetric difference] of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;???&amp;lt;/math&amp;gt; &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
 &lt;br /&gt;
'''Statement:'''&lt;br /&gt;
&lt;br /&gt;
'''Proof:'''&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2772</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2772"/>
		<updated>2015-01-27T13:16:47Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithmic problem:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is biparite.&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
&lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is initialized to be some matching, for example,  &amp;lt;math&amp;gt;M:=\empty1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If there is an augmenting alternating path, use it to increase &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;; otherwise, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Call the algorithm Find augmenting alternating path.&lt;br /&gt;
# If this call fails, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, let &amp;lt;math&amp;gt;E'&amp;lt;/math&amp;gt; denote the set of all edges on the path delivered by that call.&lt;br /&gt;
# Let &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; be the [http://en.wikipedia.org/wiki/Symmetric_difference symmetric difference] of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; and &amp;lt;math&amp;lt;???&amp;lt;/math&amp;gt; &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
 &lt;br /&gt;
'''Statement:'''&lt;br /&gt;
&lt;br /&gt;
'''Proof:'''&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2771</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2771"/>
		<updated>2015-01-27T13:16:17Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''Algorithmic problem:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is biparite.&lt;br /&gt;
&lt;br /&gt;
 '''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
 '''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
 '''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
&lt;br /&gt;
 '''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 '''Break condition:''' There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
&lt;br /&gt;
 '''Abstract view:''' &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is initialized to be some matching, for example,  &amp;lt;math&amp;gt;M:=\empty1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 '''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
 '''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
 '''Abstract view:''' If there is an augmenting alternating path, use it to increase &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;; otherwise, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 '''Implementation:'''&lt;br /&gt;
# Call the algorithm Find augmenting alternating path.&lt;br /&gt;
# If this call fails, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, let &amp;lt;math&amp;gt;E'&amp;lt;/math&amp;gt; denote the set of all edges on the path delivered by that call.&lt;br /&gt;
# Let &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; be the [http://en.wikipedia.org/wiki/Symmetric_difference symmetric difference] of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; and &amp;lt;math&amp;lt;???&amp;lt;/math&amp;gt; &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
 &lt;br /&gt;
'''Statement:'''&lt;br /&gt;
&lt;br /&gt;
'''Proof:'''&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2770</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2770"/>
		<updated>2015-01-27T13:15:51Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Complexity */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''Algorithmic problem:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is biparite.&lt;br /&gt;
 '''Type of algorithm:''' loop&lt;br /&gt;
 '''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
 '''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
 '''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
 '''Break condition:''' There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
&lt;br /&gt;
 '''Abstract view:''' &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is initialized to be some matching, for example,  &amp;lt;math&amp;gt;M:=\empty1&amp;lt;/math&amp;gt;.&lt;br /&gt;
 '''Implementation:''' Obvious.&lt;br /&gt;
 '''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
 '''Abstract view:''' If there is an augmenting alternating path, use it to increase &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;; otherwise, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
 '''Implementation:'''&lt;br /&gt;
# Call the algorithm Find augmenting alternating path.&lt;br /&gt;
# If this call fails, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, let &amp;lt;math&amp;gt;E'&amp;lt;/math&amp;gt; denote the set of all edges on the path delivered by that call.&lt;br /&gt;
# Let &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; be the [http://en.wikipedia.org/wiki/Symmetric_difference symmetric difference] of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; and &amp;lt;math&amp;lt;???&amp;lt;/math&amp;gt; &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
 &lt;br /&gt;
'''Statement:'''&lt;br /&gt;
&lt;br /&gt;
'''Proof:'''&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2769</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2769"/>
		<updated>2015-01-27T13:15:42Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Complexity */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''Algorithmic problem:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is biparite.&lt;br /&gt;
 '''Type of algorithm:''' loop&lt;br /&gt;
 '''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
 '''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
 '''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
 '''Break condition:''' There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
&lt;br /&gt;
 '''Abstract view:''' &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is initialized to be some matching, for example,  &amp;lt;math&amp;gt;M:=\empty1&amp;lt;/math&amp;gt;.&lt;br /&gt;
 '''Implementation:''' Obvious.&lt;br /&gt;
 '''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
 '''Abstract view:''' If there is an augmenting alternating path, use it to increase &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;; otherwise, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
 '''Implementation:'''&lt;br /&gt;
# Call the algorithm Find augmenting alternating path.&lt;br /&gt;
# If this call fails, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, let &amp;lt;math&amp;gt;E'&amp;lt;/math&amp;gt; denote the set of all edges on the path delivered by that call.&lt;br /&gt;
# Let &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; be the [http://en.wikipedia.org/wiki/Symmetric_difference symmetric difference] of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; and &amp;lt;math&amp;lt;???&amp;lt;/math&amp;gt; &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
 &lt;br /&gt;
'''Statement:'''&lt;br /&gt;
'''Proof:'''&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2768</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2768"/>
		<updated>2015-01-27T13:15:26Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''Algorithmic problem:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is biparite.&lt;br /&gt;
 '''Type of algorithm:''' loop&lt;br /&gt;
 '''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
 '''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
 '''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
 '''Break condition:''' There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
&lt;br /&gt;
 '''Abstract view:''' &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is initialized to be some matching, for example,  &amp;lt;math&amp;gt;M:=\empty1&amp;lt;/math&amp;gt;.&lt;br /&gt;
 '''Implementation:''' Obvious.&lt;br /&gt;
 '''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
 '''Abstract view:''' If there is an augmenting alternating path, use it to increase &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;; otherwise, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
 '''Implementation:'''&lt;br /&gt;
# Call the algorithm Find augmenting alternating path.&lt;br /&gt;
# If this call fails, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, let &amp;lt;math&amp;gt;E'&amp;lt;/math&amp;gt; denote the set of all edges on the path delivered by that call.&lt;br /&gt;
# Let &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; be the [http://en.wikipedia.org/wiki/Symmetric_difference symmetric difference] of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; and &amp;lt;math&amp;lt;???&amp;lt;/math&amp;gt; &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
 &lt;br /&gt;
 '''Statement:'''&lt;br /&gt;
 '''Proof:'''&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2767</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2767"/>
		<updated>2015-01-27T13:14:51Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Induction step */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''Algorithmic problem:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is biparite.&lt;br /&gt;
 '''Type of algorithm:''' loop&lt;br /&gt;
 '''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
 '''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
 '''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
 '''Break condition:''' There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is initialized to be some matching, for example,  &amp;lt;math&amp;gt;M:=\empty1&amp;lt;/math&amp;gt;.&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
 '''Abstract view:''' If there is an augmenting alternating path, use it to increase &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;; otherwise, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
 '''Implementation:'''&lt;br /&gt;
# Call the algorithm Find augmenting alternating path.&lt;br /&gt;
# If this call fails, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, let &amp;lt;math&amp;gt;E'&amp;lt;/math&amp;gt; denote the set of all edges on the path delivered by that call.&lt;br /&gt;
# Let &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; be the [http://en.wikipedia.org/wiki/Symmetric_difference symmetric difference] of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; and &amp;lt;math&amp;lt;???&amp;lt;/math&amp;gt; &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
 &lt;br /&gt;
 '''Statement:'''&lt;br /&gt;
 '''Proof:'''&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2766</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2766"/>
		<updated>2015-01-27T13:14:22Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Induction step */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''Algorithmic problem:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is biparite.&lt;br /&gt;
 '''Type of algorithm:''' loop&lt;br /&gt;
 '''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
 '''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
 '''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
 '''Break condition:''' There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is initialized to be some matching, for example,  &amp;lt;math&amp;gt;M:=\empty1&amp;lt;/math&amp;gt;.&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
 '''Abstract view:''' If there is an augmenting alternating path, use it to increase   &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;; otherwise, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
 '''Implementation:'''&lt;br /&gt;
# Call the algorithm Find augmenting alternating path.&lt;br /&gt;
# If this call fails, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, let &amp;lt;math&amp;gt;E'&amp;lt;/math&amp;gt; denote the set of all edges on the path delivered by that call.&lt;br /&gt;
# Let &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; be the [http://en.wikipedia.org/wiki/Symmetric_difference symmetric difference] of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; and &amp;lt;math&amp;lt;???&amp;lt;/math&amp;gt; &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
 &lt;br /&gt;
 '''Statement:'''&lt;br /&gt;
 '''Proof:'''&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2765</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2765"/>
		<updated>2015-01-27T13:14:00Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''Algorithmic problem:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is biparite.&lt;br /&gt;
 '''Type of algorithm:''' loop&lt;br /&gt;
 '''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
 '''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
 '''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
 '''Break condition:''' There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is initialized to be some matching, for example,  &amp;lt;math&amp;gt;M:=\empty1&amp;lt;/math&amp;gt;.&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' If there is an augmenting alternating path, use it to increase &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;; otherwise, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Call the algorithm Find augmenting alternating path.&lt;br /&gt;
# If this call fails, terminate the algorithm and return &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Otherwise, let &amp;lt;math&amp;gt;E'&amp;lt;/math&amp;gt; denote the set of all edges on the path delivered by that call.&lt;br /&gt;
# Let &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; be the [http://en.wikipedia.org/wiki/Symmetric_difference symmetric difference] of &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; and &amp;lt;math&amp;lt;???&amp;lt;/math&amp;gt; &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
 &lt;br /&gt;
 '''Statement:'''&lt;br /&gt;
 '''Proof:'''&lt;br /&gt;
&lt;br /&gt;
==Further information==&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2764</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2764"/>
		<updated>2015-01-27T13:02:07Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''Algorithmic problem:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is biparite.&lt;br /&gt;
 '''Type of algorithm:''' loop&lt;br /&gt;
 '''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
 '''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
 '''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
Break condition: There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
Induction basis&lt;br /&gt;
&lt;br /&gt;
Abstract view:   is initialized to be some matching, for example, .&lt;br /&gt;
Implementation: Obvious.&lt;br /&gt;
Proof: Nothing to show.&lt;br /&gt;
&lt;br /&gt;
Induction step&lt;br /&gt;
&lt;br /&gt;
Abstract view: If there is an augmenting alternating path, use it to increase ; otherwise, terminate the algorithm and return .&lt;br /&gt;
Implementation:&lt;br /&gt;
Call the algorithm Find augmenting alternating path.&lt;br /&gt;
If this call fails, terminate the algorithm and return .&lt;br /&gt;
Otherwise, let  denote the set of all edges on the path delivered by that call.&lt;br /&gt;
Let  be the symmetric difference of  and &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
Complexity&lt;br /&gt;
&lt;br /&gt;
Statement:&lt;br /&gt;
Proof:&lt;br /&gt;
&lt;br /&gt;
Further information&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2763</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2763"/>
		<updated>2015-01-27T13:01:52Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithmic problem:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is biparite.&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
'''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
 '''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
 '''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
Break condition: There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
Induction basis&lt;br /&gt;
&lt;br /&gt;
Abstract view:   is initialized to be some matching, for example, .&lt;br /&gt;
Implementation: Obvious.&lt;br /&gt;
Proof: Nothing to show.&lt;br /&gt;
&lt;br /&gt;
Induction step&lt;br /&gt;
&lt;br /&gt;
Abstract view: If there is an augmenting alternating path, use it to increase ; otherwise, terminate the algorithm and return .&lt;br /&gt;
Implementation:&lt;br /&gt;
Call the algorithm Find augmenting alternating path.&lt;br /&gt;
If this call fails, terminate the algorithm and return .&lt;br /&gt;
Otherwise, let  denote the set of all edges on the path delivered by that call.&lt;br /&gt;
Let  be the symmetric difference of  and &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
Complexity&lt;br /&gt;
&lt;br /&gt;
Statement:&lt;br /&gt;
Proof:&lt;br /&gt;
&lt;br /&gt;
Further information&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2762</id>
		<title>Alternating paths algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Alternating_paths_algorithm&amp;diff=2762"/>
		<updated>2015-01-27T13:01:28Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Algorithm]]&lt;br /&gt;
[[Category:Maximum matching problem]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Algorithmic problem:''' The graph &amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt; is biparite.&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
'''Auxillary data:'''&lt;br /&gt;
&lt;br /&gt;
== Abstract view ==&lt;br /&gt;
&lt;br /&gt;
'''Invariant:''' Before and after each iteration, &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt; is a matching. &lt;br /&gt;
'''Variant:''' &amp;lt;math&amp;gt;|M|&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
Break condition: There is no more augmenting alternating path.&lt;br /&gt;
&lt;br /&gt;
Induction basis&lt;br /&gt;
&lt;br /&gt;
Abstract view:   is initialized to be some matching, for example, .&lt;br /&gt;
Implementation: Obvious.&lt;br /&gt;
Proof: Nothing to show.&lt;br /&gt;
&lt;br /&gt;
Induction step&lt;br /&gt;
&lt;br /&gt;
Abstract view: If there is an augmenting alternating path, use it to increase ; otherwise, terminate the algorithm and return .&lt;br /&gt;
Implementation:&lt;br /&gt;
Call the algorithm Find augmenting alternating path.&lt;br /&gt;
If this call fails, terminate the algorithm and return .&lt;br /&gt;
Otherwise, let  denote the set of all edges on the path delivered by that call.&lt;br /&gt;
Let  be the symmetric difference of  and &lt;br /&gt;
Correctness:&lt;br /&gt;
&lt;br /&gt;
Complexity&lt;br /&gt;
&lt;br /&gt;
Statement:&lt;br /&gt;
Proof:&lt;br /&gt;
&lt;br /&gt;
Further information&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2758</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2758"/>
		<updated>2015-01-15T17:33:04Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Induction step */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;lt;p&amp;lt;/math&amp;gt;  for &amp;lt;math&amp;gt; j \in {1,...,i_1-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_1 &amp;lt; m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_1] \nless p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] =p&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt; j \in {m_1,...,i_2-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_2 &amp;lt; m_2&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;gt;p&amp;lt;/math&amp;gt;for &amp;lt;math&amp;gt; j \in {m_2,...,i_3-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_3 \le m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_3] \ngtr p&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
'''Variant:''' At least one of &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt; is increased by at least &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;, none of them is decreased.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i_1=m_1, i_2=m_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_3 = n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; according to the loop invariant.&lt;br /&gt;
# Initialize &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt;.&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m_1:=1&amp;lt;/math&amp;gt; .&lt;br /&gt;
# For &amp;lt;math&amp;gt;j \in {1,...,n}&amp;lt;/math&amp;gt;: If &amp;lt;math&amp;gt;S[j]&amp;lt;p&amp;lt;/math&amp;gt; increase &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m_2:m_1&amp;lt;/math&amp;gt;&lt;br /&gt;
# For &amp;lt;math&amp;gt;j \in {1,...,n}&amp;lt;/math&amp;gt;: If &amp;lt;math&amp;gt;S[j]=p&amp;lt;/math&amp;gt; increase &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;i_1:=1&amp;lt;/math&amp;gt;. &lt;br /&gt;
# &amp;lt;math&amp;gt;i_2:=m_1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;i_3:=m_2&amp;lt;/math&amp;gt;. &lt;br /&gt;
# While &amp;lt;math&amp;gt;i_1&amp;lt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[j]&amp;lt;p&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt;i_1:=i_1+1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# While &amp;lt;math&amp;gt;i_2&amp;lt;m_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[j]=p&amp;lt;/math&amp;gt; , set &amp;lt;math&amp;gt;i_2:=i_2+1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# While &amp;lt;math&amp;gt;i_3&amp;lt;n&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[j]&amp;gt;p&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt;i_3:=i_3+1&amp;lt;/math&amp;gt; .&lt;br /&gt;
'''Proof:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
==Induction step==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# Move each of &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt; forward as long as the invariant is not violated.&lt;br /&gt;
# If the algorithm is not done yet, identify two out of the three index pointers &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt;such that at least one of these two can be moved one step forward after a swap of the elements at these two positions.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' &lt;br /&gt;
# If &amp;lt;math&amp;gt;i_1=m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_2=m_2&amp;lt;/math&amp;gt;  and &amp;lt;math&amp;gt;i_3=n+1&amp;lt;/math&amp;gt;, terminate the algorithm and return &amp;lt;math&amp;gt;m_1,m_2-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;i_1&amp;lt;m_1&amp;lt;/math&amp;gt; :&lt;br /&gt;
## If &amp;lt;math&amp;gt;S[i_1]=p&amp;lt;/math&amp;gt;:&lt;br /&gt;
### Swap &amp;lt;math&amp;gt;S[i_1]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[i_2]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### Set &amp;lt;math&amp;gt;i_2:=i_2+1&amp;lt;/math&amp;gt; until &amp;lt;math&amp;gt;i_2=m_2&amp;lt;/math&amp;gt; or else &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt;.&lt;br /&gt;
## Otherwise (that is, &amp;lt;math&amp;gt;S[i_1]&amp;gt;p&amp;lt;/math&amp;gt;):&lt;br /&gt;
### Swap &amp;lt;math&amp;gt;S[i_1]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[i_3]&amp;lt;/math&amp;gt;.&lt;br /&gt;
###Set &amp;lt;math&amp;gt;i_3:=i_3+1&amp;lt;/math&amp;gt; until &amp;lt;math&amp;gt;i_3=n+1&amp;lt;/math&amp;gt; or else &amp;lt;math&amp;gt;S[i_3] \ngtr p&amp;lt;/math&amp;gt;.&lt;br /&gt;
## While  and , set .&lt;br /&gt;
# Otherwise (that is, &amp;lt;math&amp;gt;i_1=m_1&amp;lt;/math&amp;gt;):&lt;br /&gt;
## Swap &amp;lt;math&amp;gt;S[i_2]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[i_3]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## Set &amp;lt;math&amp;gt;i_2:=i_2+1&amp;lt;/math&amp;gt; until &amp;lt;math&amp;gt;i_2=m2&amp;lt;/math&amp;gt; or else &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt; .&lt;br /&gt;
## Set &amp;lt;math&amp;gt;i_3:=i_3+1&amp;lt;/math&amp;gt; until &amp;lt;math&amp;gt;i_3=n+1&amp;lt;/math&amp;gt; or else &amp;lt;math&amp;gt;S[i_3] \ngtr p&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness''': Due to the various &amp;quot;otherwise&amp;quot; clauses, all possible cases are covered. Therefore, it remains to show that the invariants are maintained in each of the considered cases. &lt;br /&gt;
As the values of  and  are never changed after initialization, all three parts of the first invariant are trivially maintained. Since  (resp., , ) is only increased in case  (resp., , ), Invariant 2.1 is maintained as well. So, we will focus on Invariants 2.2-2.4. &lt;br /&gt;
If Step 2 applies, maintenance of Invariants 2.2-2.4 might be obvious. So consider Step 3. If Step 3 applies, we know that , but  or  (or both). Due to , all elements less than  are correctly placed at the positions . Therefore, both cases, the case  and  and the case  and  are impossible, because there cannot be exactly one wrongly placed element. In other words, it is  and  in Step 3. Again due to , it is  and . Steps 2.1.2 and 2.2.2 ensure  and , so we have  and . This observation justifies the procedure of Step 3.&lt;br /&gt;
&lt;br /&gt;
looooooooooooooooooooooooooooool&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2757</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2757"/>
		<updated>2015-01-15T17:17:32Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Induction step */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;lt;p&amp;lt;/math&amp;gt;  for &amp;lt;math&amp;gt; j \in {1,...,i_1-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_1 &amp;lt; m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_1] \nless p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] =p&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt; j \in {m_1,...,i_2-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_2 &amp;lt; m_2&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;gt;p&amp;lt;/math&amp;gt;for &amp;lt;math&amp;gt; j \in {m_2,...,i_3-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_3 \le m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_3] \ngtr p&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
'''Variant:''' At least one of &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt; is increased by at least &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;, none of them is decreased.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i_1=m_1, i_2=m_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_3 = n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; according to the loop invariant.&lt;br /&gt;
# Initialize &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt;.&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m_1:=1&amp;lt;/math&amp;gt; .&lt;br /&gt;
# For &amp;lt;math&amp;gt;j \in {1,...,n}&amp;lt;/math&amp;gt;: If &amp;lt;math&amp;gt;S[j]&amp;lt;p&amp;lt;/math&amp;gt; increase &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m_2:m_1&amp;lt;/math&amp;gt;&lt;br /&gt;
# For &amp;lt;math&amp;gt;j \in {1,...,n}&amp;lt;/math&amp;gt;: If &amp;lt;math&amp;gt;S[j]=p&amp;lt;/math&amp;gt; increase &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;i_1:=1&amp;lt;/math&amp;gt;. &lt;br /&gt;
# &amp;lt;math&amp;gt;i_2:=m_1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;i_3:=m_2&amp;lt;/math&amp;gt;. &lt;br /&gt;
# While &amp;lt;math&amp;gt;i_1&amp;lt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[j]&amp;lt;p&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt;i_1:=i_1+1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# While &amp;lt;math&amp;gt;i_2&amp;lt;m_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[j]=p&amp;lt;/math&amp;gt; , set &amp;lt;math&amp;gt;i_2:=i_2+1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# While &amp;lt;math&amp;gt;i_3&amp;lt;n&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[j]&amp;gt;p&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt;i_3:=i_3+1&amp;lt;/math&amp;gt; .&lt;br /&gt;
'''Proof:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
==Induction step==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# Move each of &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt; forward as long as the invariant is not violated.&lt;br /&gt;
# If the algorithm is not done yet, identify two out of the three index pointers &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt;such that at least one of these two can be moved one step forward after a swap of the elements at these two positions.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' &lt;br /&gt;
# If &amp;lt;math&amp;gt;i_1=m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_2=m_2&amp;lt;/math&amp;gt;  and &amp;lt;math&amp;gt;i_3=n+1&amp;lt;/math&amp;gt;, terminate the algorithm and return &amp;lt;math&amp;gt;m_1,m_2-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;i_1&amp;lt;m_1&amp;lt;/math&amp;gt; :&lt;br /&gt;
## If &amp;lt;math&amp;gt;S[i_1]=p&amp;lt;/math&amp;gt;:&lt;br /&gt;
### Swap &amp;lt;math&amp;gt;S[i_1]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[i_2]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### Set &amp;lt;math&amp;gt;i_2:=i_2+1&amp;lt;/math&amp;gt; until &amp;lt;math&amp;gt;i_2=m_2&amp;lt;/math&amp;gt; or else &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt;.&lt;br /&gt;
## Otherwise (that is, &amp;lt;math&amp;gt;S[i_1]&amp;gt;p&amp;lt;/math&amp;gt;):&lt;br /&gt;
### Swap &amp;lt;math&amp;gt;S[i_1]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[i_3]&amp;lt;/math&amp;gt;.&lt;br /&gt;
###Set &amp;lt;math&amp;gt;i_3:=i_3+1&amp;lt;/math&amp;gt; until &amp;lt;math&amp;gt;i_3=n+1&amp;lt;/math&amp;gt; or else &amp;lt;math&amp;gt;S[i_3] \ngtr p&amp;lt;/math&amp;gt;.&lt;br /&gt;
## While  and , set .&lt;br /&gt;
# Otherwise (that is, &amp;lt;math&amp;gt;i_1=m_1&amp;lt;/math&amp;gt;):&lt;br /&gt;
## Swap &amp;lt;math&amp;gt;S[i_2]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[i_3]&amp;lt;/math&amp;gt;.&lt;br /&gt;
## Set &amp;lt;math&amp;gt;i_2:=i_2+1&amp;lt;/math&amp;gt; until &amp;lt;math&amp;gt;i_2=m2&amp;lt;/math&amp;gt; or else &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt; .&lt;br /&gt;
## Set &amp;lt;math&amp;gt;i_3:=i_3+1&amp;lt;/math&amp;gt; until &amp;lt;math&amp;gt;i_3=n+1&amp;lt;/math&amp;gt; or else &amp;lt;math&amp;gt;S[i_3] \ngtr p&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Correctness''': Due to the various &amp;quot;otherwise&amp;quot; clauses, all possible cases are covered. Therefore, it remains to show that the invariants are maintained in each of the considered cases. &lt;br /&gt;
As the values of  and  are never changed after initialization, all three parts of the first invariant are trivially maintained. Since  (resp., , ) is only increased in case  (resp., , ), Invariant 2.1 is maintained as well. So, we will focus on Invariants 2.2-2.4. &lt;br /&gt;
If Step 2 applies, maintenance of Invariants 2.2-2.4 might be obvious. So consider Step 3. If Step 3 applies, we know that , but  or  (or both). Due to , all elements less than  are correctly placed at the positions . Therefore, both cases, the case  and  and the case  and  are impossible, because there cannot be exactly one wrongly placed element. In other words, it is  and  in Step 3. Again due to , it is  and . Steps 2.1.2 and 2.2.2 ensure  and , so we have  and . This observation justifies the procedure of Step 3.&lt;br /&gt;
&lt;br /&gt;
.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2756</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2756"/>
		<updated>2015-01-15T17:10:26Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;lt;p&amp;lt;/math&amp;gt;  for &amp;lt;math&amp;gt; j \in {1,...,i_1-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_1 &amp;lt; m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_1] \nless p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] =p&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt; j \in {m_1,...,i_2-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_2 &amp;lt; m_2&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;gt;p&amp;lt;/math&amp;gt;for &amp;lt;math&amp;gt; j \in {m_2,...,i_3-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_3 \le m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_3] \ngtr p&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
'''Variant:''' At least one of &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt; is increased by at least &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;, none of them is decreased.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i_1=m_1, i_2=m_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_3 = n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; according to the loop invariant.&lt;br /&gt;
# Initialize &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt;.&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m_1:=1&amp;lt;/math&amp;gt; .&lt;br /&gt;
# For &amp;lt;math&amp;gt;j \in {1,...,n}&amp;lt;/math&amp;gt;: If &amp;lt;math&amp;gt;S[j]&amp;lt;p&amp;lt;/math&amp;gt; increase &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m_2:m_1&amp;lt;/math&amp;gt;&lt;br /&gt;
# For &amp;lt;math&amp;gt;j \in {1,...,n}&amp;lt;/math&amp;gt;: If &amp;lt;math&amp;gt;S[j]=p&amp;lt;/math&amp;gt; increase &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;i_1:=1&amp;lt;/math&amp;gt;. &lt;br /&gt;
# &amp;lt;math&amp;gt;i_2:=m_1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;i_3:=m_2&amp;lt;/math&amp;gt;. &lt;br /&gt;
# While &amp;lt;math&amp;gt;i_1&amp;lt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[j]&amp;lt;p&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt;i_1:=i_1+1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# While &amp;lt;math&amp;gt;i_2&amp;lt;m_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[j]=p&amp;lt;/math&amp;gt; , set &amp;lt;math&amp;gt;i_2:=i_2+1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# While &amp;lt;math&amp;gt;i_3&amp;lt;n&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[j]&amp;gt;p&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt;i_3:=i_3+1&amp;lt;/math&amp;gt; .&lt;br /&gt;
'''Proof:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
==Induction step==&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' &lt;br /&gt;
# Move each of &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt; forward as long as the invariant is not violated.&lt;br /&gt;
# If the algorithm is not done yet, identify two out of the three index pointers &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt;such that at least one of these two can be moved one step forward after a swap of the elements at these two positions.&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' &lt;br /&gt;
# If &amp;lt;math&amp;gt;i_1=m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_2=m_2&amp;lt;/math&amp;gt;  and &amp;lt;math&amp;gt;i_3=n+1&amp;lt;/math&amp;gt;, terminate the algorithm and return &amp;lt;math&amp;gt;m_1,m_2-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;i_1&amp;lt;m_1&amp;lt;/math&amp;gt; :&lt;br /&gt;
## If &amp;lt;math&amp;gt;S[i_1]=p&amp;lt;/math&amp;gt; :&lt;br /&gt;
### Swap &amp;lt;math&amp;gt;S[i_1]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[i_2]&amp;lt;/math&amp;gt;.&lt;br /&gt;
### Set &amp;lt;math&amp;gt;i_2:=i_2+1&amp;lt;/math&amp;gt; until &amp;lt;math&amp;gt;i_2=m_2&amp;lt;/math&amp;gt; or else &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt;.&lt;br /&gt;
## Otherwise (that is, ):&lt;br /&gt;
### Swap  and .&lt;br /&gt;
###Set  until  or else .&lt;br /&gt;
## While  and , set .&lt;br /&gt;
# Otherwise (that is, ):&lt;br /&gt;
## Swap  and .&lt;br /&gt;
## Set  until  or else .&lt;br /&gt;
## Set  until  or else .&lt;br /&gt;
Correctness: Due to the various &amp;quot;otherwise&amp;quot; clauses, all possible cases are covered. Therefore, it remains to show that the invariants are maintained in each of the considered cases. &lt;br /&gt;
As the values of  and  are never changed after initialization, all three parts of the first invariant are trivially maintained. Since  (resp., , ) is only increased in case  (resp., , ), Invariant 2.1 is maintained as well. So, we will focus on Invariants 2.2-2.4. &lt;br /&gt;
If Step 2 applies, maintenance of Invariants 2.2-2.4 might be obvious. So consider Step 3. If Step 3 applies, we know that , but  or  (or both). Due to , all elements less than  are correctly placed at the positions . Therefore, both cases, the case  and  and the case  and  are impossible, because there cannot be exactly one wrongly placed element. In other words, it is  and  in Step 3. Again due to , it is  and . Steps 2.1.2 and 2.2.2 ensure  and , so we have  and . This observation justifies the procedure of Step 3.&lt;br /&gt;
&lt;br /&gt;
.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2755</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2755"/>
		<updated>2015-01-15T16:59:15Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;lt;p&amp;lt;/math&amp;gt;  for &amp;lt;math&amp;gt; j \in {1,...,i_1-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_1 &amp;lt; m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_1] \nless p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] =p&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt; j \in {m_1,...,i_2-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_2 &amp;lt; m_2&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;gt;p&amp;lt;/math&amp;gt;for &amp;lt;math&amp;gt; j \in {m_2,...,i_3-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_3 \le m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_3] \ngtr p&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
'''Variant:''' At least one of &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt; is increased by at least &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;, none of them is decreased.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i_1=m_1, i_2=m_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_3 = n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; according to the loop invariant.&lt;br /&gt;
# Initialize &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt;.&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m_1:=1&amp;lt;/math&amp;gt; .&lt;br /&gt;
# For &amp;lt;math&amp;gt;j \in {1,...,n}&amp;lt;/math&amp;gt;: If &amp;lt;math&amp;gt;S[j]&amp;lt;p&amp;lt;/math&amp;gt; increase &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Set &amp;lt;math&amp;gt;m_2:m_1&amp;lt;/math&amp;gt;&lt;br /&gt;
# For &amp;lt;math&amp;gt;j \in {1,...,n}&amp;lt;/math&amp;gt;: If &amp;lt;math&amp;gt;S[j]=p&amp;lt;/math&amp;gt; increase &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;i_1:=1&amp;lt;/math&amp;gt;. &lt;br /&gt;
# &amp;lt;math&amp;gt;i_2:=m_1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# &amp;lt;math&amp;gt;i_3:=m_2&amp;lt;/math&amp;gt;. &lt;br /&gt;
# While &amp;lt;math&amp;gt;i_1&amp;lt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[j]&amp;lt;p&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt;i_1:=i_1+1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# While &amp;lt;math&amp;gt;i_2&amp;lt;m_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[j]=p&amp;lt;/math&amp;gt; , set &amp;lt;math&amp;gt;i_2:=i_2+1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# While &amp;lt;math&amp;gt;i_3&amp;lt;n&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;S[j]&amp;gt;p&amp;lt;/math&amp;gt;, set &amp;lt;math&amp;gt;i_3:=i_3+1&amp;lt;/math&amp;gt; .&lt;br /&gt;
'''Proof:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
==Induction basis==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2754</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2754"/>
		<updated>2015-01-15T16:45:40Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;lt;p&amp;lt;/math&amp;gt;  for &amp;lt;math&amp;gt; j \in {1,...,i_1-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_1 &amp;lt; m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_1] \nless p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] =p&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt; j \in {m_1,...,i_2-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_2 &amp;lt; m_2&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;gt;p&amp;lt;/math&amp;gt;for &amp;lt;math&amp;gt; j \in {m_2,...,i_3-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_3 \le m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_3] \ngtr p&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
'''Variant:''' At least one of &amp;lt;math&amp;gt;i_1,i_2&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt; is increased by at least &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;, none of them is decreased.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i_1=m_1, i_2=m_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_3 = n+1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2753</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2753"/>
		<updated>2015-01-15T16:44:19Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;lt;p&amp;lt;/math&amp;gt;  for &amp;lt;math&amp;gt; j \in {1,...,i_1-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_1 &amp;lt; m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_1] \nless p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] =p&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt; j \in {m_1,...,i_2-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_2 &amp;lt; m_2&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;gt;p&amp;lt;/math&amp;gt;for &amp;lt;math&amp;gt; j \in {m_2,...,i_3-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_3 \le m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_3] \ngtr p&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
'''Variant:''' At least one of &amp;lt;math&amp;gt;i_1,i_2,&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt; is increased by at least &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i_1=m_1, i_2=m_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_3 = n+1&amp;lt;/math&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2752</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2752"/>
		<updated>2015-01-15T16:43:20Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;lt;p&amp;lt;/math&amp;gt;  for &amp;lt;math&amp;gt; j \in {1,...,i_1-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_1 &amp;lt; m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_1] \nless p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] =p&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt; j \in {m_1,...,i_2-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_2 &amp;lt; m_2&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;gt;p&amp;lt;/math&amp;gt;for &amp;lt;math&amp;gt; j \in {m_2,...,i_3-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_3 \le m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_3] \ngtr p&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
Variant: At least one of , and  is increased by at least , none of them is decreased.&lt;br /&gt;
Break condition: It is ,  and .&lt;br /&gt;
&lt;br /&gt;
'''Variant:''' At least one of &amp;lt;math&amp;gt;i_1,i_2,&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_3&amp;lt;/math&amp;gt; is increased by at least &amp;lt;math&amp;gt;1&amp;lt;/math increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i_1=m_1, i_2=m_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;i_3 = n+1&amp;lt;/math&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2751</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2751"/>
		<updated>2015-01-13T15:55:57Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;lt;p&amp;lt;/math&amp;gt;  for &amp;lt;math&amp;gt; j \in {1,...,i_1-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_1 &amp;lt; m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_1] \nless p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] =p&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt; j \in {m_1,...,i_2-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_2 &amp;lt; m_2&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;gt;p&amp;lt;/math&amp;gt;for &amp;lt;math&amp;gt; j \in {m_2,...,i_3-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_3 \le m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_3] \ngtr p&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
Variant: At least one of , and  is increased by at least , none of them is decreased.&lt;br /&gt;
Break condition: It is ,  and .&lt;br /&gt;
&lt;br /&gt;
'''Varian:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i=n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2750</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2750"/>
		<updated>2015-01-13T15:55:46Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;lt;p&amp;lt;/math&amp;gt;  for &amp;lt;math&amp;gt; j \in {1,...,i_1-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_1 &amp;lt; m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_1] \nless p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] =p&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt; j \in {m_1,...,i_2-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_2 &amp;lt; m_2&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;gt;p&amp;lt;/math&amp;gt;for &amp;lt;math&amp;gt; j \in {m_2,...,i_3-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_3 /le m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_3] \ngtr p&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
Variant: At least one of , and  is increased by at least , none of them is decreased.&lt;br /&gt;
Break condition: It is ,  and .&lt;br /&gt;
&lt;br /&gt;
'''Varian:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i=n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2749</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2749"/>
		<updated>2015-01-13T15:55:12Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;lt;p&amp;lt;/math&amp;gt;  for &amp;lt;math&amp;gt; j \in {1,...,i_1-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_1 &amp;lt; m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_1] \nless p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] =p&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt; j \in {m_1,...,i_2-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_2 &amp;lt; m_2&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_2] \ne p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;gt;p&amp;lt;/math&amp;gt;for &amp;lt;math&amp;gt; j \in {m_2,...,i_3-1}&amp;lt;/math&amp;gt;; if &amp;lt;math&amp;gt;i_3 {öe m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_3] \ngtr p&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
Variant: At least one of , and  is increased by at least , none of them is decreased.&lt;br /&gt;
Break condition: It is ,  and .&lt;br /&gt;
&lt;br /&gt;
'''Varian:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i=n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2748</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2748"/>
		<updated>2015-01-13T15:44:24Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;lt;p&amp;lt;/math&amp;gt;  for &amp;lt;math&amp;gt; j \in {1,...,i_1-1}; if &amp;lt;math&amp;gt;i_1 &amp;lt; m_1&amp;lt;/math&amp;gt;, it is &amp;lt;math&amp;gt;S[i_1] \ntlr p&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] =p&amp;lt;/math&amp;gt; for ; if , it is ;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] &amp;gt;p&amp;lt;/math&amp;gt;for ; if , it is .  &lt;br /&gt;
&lt;br /&gt;
Variant: At least one of , and  is increased by at least , none of them is decreased.&lt;br /&gt;
Break condition: It is ,  and .&lt;br /&gt;
&lt;br /&gt;
'''Varian:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i=n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2747</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2747"/>
		<updated>2015-01-13T15:37:59Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
## &amp;lt;math&amp;gt;S[j] \le&amp;lt;/math&amp;gt;  for ; if , it is ;&lt;br /&gt;
 for ; if , it is ;&lt;br /&gt;
 for ; if , it is .  &lt;br /&gt;
&lt;br /&gt;
Variant: At least one of , and  is increased by at least , none of them is decreased.&lt;br /&gt;
Break condition: It is ,  and .&lt;br /&gt;
&lt;br /&gt;
'''Varian:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i=n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2746</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2746"/>
		<updated>2015-01-13T15:36:14Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
Variant: At least one of , and  is increased by at least , none of them is decreased.&lt;br /&gt;
Break condition: It is ,  and .&lt;br /&gt;
&lt;br /&gt;
'''Varian:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i=n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2745</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2745"/>
		<updated>2015-01-13T15:32:46Z</updated>

		<summary type="html">&lt;p&gt;JanR: /* Abstract View */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
   ## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
  &lt;br /&gt;
 for ; if , it is ;&lt;br /&gt;
 for ; if , it is .&lt;br /&gt;
Variant: At least one of , and  is increased by at least , none of them is decreased.&lt;br /&gt;
Break condition: It is ,  and .&lt;br /&gt;
&lt;br /&gt;
'''Varian:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i=n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2744</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2744"/>
		<updated>2015-01-13T15:25:06Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
 ## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
 ## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
 ## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
   ## &amp;lt;math&amp;gt;1 \le i_2 \le m_1 \le m_2 \le i_3 \le i_3 \le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
  &lt;br /&gt;
 for ; if , it is ;&lt;br /&gt;
 for ; if , it is .&lt;br /&gt;
Variant: At least one of , and  is increased by at least , none of them is decreased.&lt;br /&gt;
Break condition: It is ,  and .&lt;br /&gt;
&lt;br /&gt;
'''Varian:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i=n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2743</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2743"/>
		<updated>2015-01-13T15:21:15Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
 ## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
 ## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
 ## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
 ## &amp;lt;math&amp;gt;1 &amp;amp;le i_2 &amp;amp;le m_1 &amp;amp;le m_2 &amp;amp;le i_3 &amp;amp;le i_3 &amp;amp;le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
 &lt;br /&gt;
 for ; if , it is ;&lt;br /&gt;
 for ; if , it is .&lt;br /&gt;
Variant: At least one of , and  is increased by at least , none of them is decreased.&lt;br /&gt;
Break condition: It is ,  and .&lt;br /&gt;
&lt;br /&gt;
'''Varian:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i=n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2742</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2742"/>
		<updated>2015-01-13T15:20:49Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
 ## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
 ## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
 ## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
 ## &amp;lt;math&amp;gt;1 &amp;amp;le i_2 &amp;amp;le m_1 &amp;amp;le m_2 &amp;amp;le i_3 &amp;amp;le i_3 &amp;amp;le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
 ## &amp;lt;math&amp;gt;S[j]&amp;lt;/math&amp;gt;for ; if , it is ;&lt;br /&gt;
 for ; if , it is ;&lt;br /&gt;
 for ; if , it is .&lt;br /&gt;
Variant: At least one of , and  is increased by at least , none of them is decreased.&lt;br /&gt;
Break condition: It is ,  and .&lt;br /&gt;
&lt;br /&gt;
'''Varian:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i=n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2741</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2741"/>
		<updated>2015-01-13T15:20:30Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
 ## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
 ## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
 ## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
 ## &amp;lt;math&amp;gt;1 &amp;amp;le i_2 &amp;amp;le m_1 &amp;amp;le m_2 &amp;amp;lei3 &amp;amp;le i_3 &amp;amp;le n+1&amp;lt;/math&amp;gt;;&lt;br /&gt;
 ## &amp;lt;math&amp;gt;S[j]&amp;lt;/math&amp;gt;for ; if , it is ;&lt;br /&gt;
 for ; if , it is ;&lt;br /&gt;
 for ; if , it is .&lt;br /&gt;
Variant: At least one of , and  is increased by at least , none of them is decreased.&lt;br /&gt;
Break condition: It is ,  and .&lt;br /&gt;
&lt;br /&gt;
'''Varian:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i=n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2740</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2740"/>
		<updated>2015-01-13T15:19:56Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
 ## &amp;lt;math&amp;gt;m_1-1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
 ## &amp;lt;math&amp;gt;m_1-m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
 ## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
 ## &amp;lt;math&amp;gt;1 &amp;amp;le i_2 &amp;amp;le m_1 &amp;amp;le m_2 &amp;amp;lei3 &amp;amp;le i_3 &amp;amp;le n+1&amp;lt;math&amp;gt;;&lt;br /&gt;
 ## &amp;lt;math&amp;gt;S[j]&amp;lt;/math&amp;gt;for ; if , it is ;&lt;br /&gt;
 for ; if , it is ;&lt;br /&gt;
 for ; if , it is .&lt;br /&gt;
Variant: At least one of , and  is increased by at least , none of them is decreased.&lt;br /&gt;
Break condition: It is ,  and .&lt;br /&gt;
&lt;br /&gt;
'''Varian:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i=n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2739</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2739"/>
		<updated>2015-01-13T15:19:37Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' &lt;br /&gt;
# The values of &amp;lt;math&amp;gt;m_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m_2&amp;lt;/math&amp;gt; only depend on the input sequence and are, hence, constant throughout the loop. More specifically, in  there are&lt;br /&gt;
 ## &amp;lt;math&amp;gt;m_1 - 1&amp;lt;/math&amp;gt; elements less than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;,&lt;br /&gt;
 ## &amp;lt;math&amp;gt;m_1 - m_2&amp;lt;/math&amp;gt; elements equal to &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;, and&lt;br /&gt;
 ## &amp;lt;math&amp;gt;n - m_2&amp;lt;/math&amp;gt;greater than &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Before and after each iteration, it is:&lt;br /&gt;
 ## &amp;lt;math&amp;gt;1 &amp;amp;le i_2 &amp;amp;le m_1 &amp;amp;le m_2 &amp;amp;lei3 &amp;amp;le i_3 &amp;amp;le n+1&amp;lt;math&amp;gt;;&lt;br /&gt;
 ## &amp;lt;math&amp;gt;S[j]&amp;lt;/math&amp;gt;for ; if , it is ;&lt;br /&gt;
 for ; if , it is ;&lt;br /&gt;
 for ; if , it is .&lt;br /&gt;
Variant: At least one of , and  is increased by at least , none of them is decreased.&lt;br /&gt;
Break condition: It is ,  and .&lt;br /&gt;
&lt;br /&gt;
'''Varian:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i=n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
	<entry>
		<id>https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2738</id>
		<title>Pivot partitioning by scanning</title>
		<link rel="alternate" type="text/html" href="https://wiki.algo.informatik.tu-darmstadt.de/index.php?title=Pivot_partitioning_by_scanning&amp;diff=2738"/>
		<updated>2015-01-13T15:08:39Z</updated>

		<summary type="html">&lt;p&gt;JanR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
'''Algorithmic problem:''' Pivot partioning by scanning&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites:''' None&lt;br /&gt;
&lt;br /&gt;
'''Type of algorithm:''' loop&lt;br /&gt;
&lt;br /&gt;
'''Auxiliary data:''' Five index pointers, &amp;lt;math&amp;gt;m_1,m_2,i_1,i_2,i_3 \in \mathbb N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Auxilliary data:'''&lt;br /&gt;
# A constant representing the number of node: &amp;lt;math&amp;gt;n = |V|&amp;lt;/math&amp;gt;&lt;br /&gt;
# A [[distance-valued]] &amp;lt;math&amp;gt;(n \times n)&amp;lt;/math&amp;gt; matrix &amp;lt;math&amp;gt;M&amp;lt;/math&amp;gt;&lt;br /&gt;
# C An ordering of all nodes, that is, &amp;lt;math&amp;gt;V = \{u_1, \ldots ,u_n\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract View ==&lt;br /&gt;
'''Invariant:''' After &amp;lt;math&amp;gt;i \ge 0&amp;lt;/math&amp;gt; iterations, for &amp;lt;math&amp;gt;v,w \in V&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; is the length of a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] of the path belong to &amp;lt;math&amp;gt;\{u_1, \ldots , u_i\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Varian:''' &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; increases by &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Break condition:''' It is &amp;lt;math&amp;gt;i=n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Induction basis ==&lt;br /&gt;
'''Abstract view:''' &amp;lt;math&amp;gt;\forall v,w \in V&amp;lt;/math&amp;gt; we set&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,v):=0, \forall v \in V&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):=l(v,w), (v,w) \in A&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math&amp;gt;M(v,w):= +\infty&amp;lt;/math&amp;gt;, otherwise&lt;br /&gt;
&lt;br /&gt;
'''Implementation:''' Obvious.&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' Nothing to show.&lt;br /&gt;
&lt;br /&gt;
== Induction step ==&lt;br /&gt;
'''Abstract view:'''&lt;br /&gt;
&lt;br /&gt;
'''Implementation:'''&lt;br /&gt;
&lt;br /&gt;
'''Correctness:''' Let &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; denote a shoortest &amp;lt;math&amp;gt;(v,w&amp;lt;/math&amp;gt;-path subject to the constraint that all [[internal nodes]] are taken from &amp;lt;math&amp;gt;\{u_1, \ldots, u_n \}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does not contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; is even a shortest &amp;lt;math&amp;gt;(v,w)&amp;lt;/math&amp;gt;-path such that all internal nodes are taken from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. In this case, the induction hypothesis implies that the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; immediately before the i-th iteration equals the length of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;. Clearly, the i-th iteration does not change the value of &amp;lt;math&amp;gt;M(v,w)&amp;lt;/math&amp;gt; in this case.&lt;br /&gt;
# On the other hand, suppose &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; does contain &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt;. Due to the [[prefix property]], the segment of &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; and from &amp;lt;math&amp;gt;u_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; are a shortest &amp;lt;math&amp;gt;(v,u_i)&amp;lt;/math&amp;gt;-path and a shortest &amp;lt;math&amp;gt;(u_i,w)&amp;lt;/math&amp;gt;-path, respectively, subject to the constraint that all internal nodes are from &amp;lt;math&amp;gt;\{u_1, \ldots , u_{i-1} \}&amp;lt;/math&amp;gt;. The induction hypothesis implies that tehese lengths equal the values &amp;lt;math&amp;gt;M(v,u_i)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;M(u_i, w)&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
== Complexity ==&lt;br /&gt;
'''Statement:''' &amp;lt;math&amp;gt;\mathcal{O}(n^3)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Proof:''' The overall loop has &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; iterations. In each iteration, we update all &amp;lt;math&amp;gt;n^2&amp;lt;/math&amp;gt; matrix entities. Each update requires a constant number of steps.&lt;/div&gt;</summary>
		<author><name>JanR</name></author>
	</entry>
</feed>