<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://eoa.aitzazimtiaz.xyz/index.php?action=history&amp;feed=atom&amp;title=Insertion_Sort</id>
	<title>Insertion Sort - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://eoa.aitzazimtiaz.xyz/index.php?action=history&amp;feed=atom&amp;title=Insertion_Sort"/>
	<link rel="alternate" type="text/html" href="https://eoa.aitzazimtiaz.xyz/index.php?title=Insertion_Sort&amp;action=history"/>
	<updated>2026-08-04T17:14:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://eoa.aitzazimtiaz.xyz/index.php?title=Insertion_Sort&amp;diff=30&amp;oldid=prev</id>
		<title>Aitzaz: Add the algorithm.</title>
		<link rel="alternate" type="text/html" href="https://eoa.aitzazimtiaz.xyz/index.php?title=Insertion_Sort&amp;diff=30&amp;oldid=prev"/>
		<updated>2026-08-03T23:33:22Z</updated>

		<summary type="html">&lt;p&gt;Add the algorithm.&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:33, 3 August 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{Stub}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Infobox algorithm&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Infobox algorithm&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| name = Insertion sort&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| name = Insertion sort&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| signature = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;span class=&quot;eoa-proc&quot;&amp;gt;&lt;/del&gt;Insertion-Sort&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt;&lt;/del&gt;(&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;A&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt;, &amp;lt;span class=&quot;eoa-var&quot;&amp;gt;n&amp;lt;/span&amp;gt;&lt;/del&gt;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| signature = Insertion-Sort(A)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| code =&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| code =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;# &#039;&#039;&#039;&lt;/del&gt;for&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039; &amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;i&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt; &lt;/del&gt;= 2 &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;&lt;/del&gt;to&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039; &amp;lt;span class=&quot;eoa-var&quot;&amp;gt;n&amp;lt;/span&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;for i = 2 to &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;A.length&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;# {{I}}&amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;key&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt; &lt;/del&gt;= &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;A&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt;&lt;/del&gt;[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;i&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt;&lt;/del&gt;]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;key = A[i]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;# {{I}}&amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;j&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt; &lt;/del&gt;= &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;span class=&quot;eoa&lt;/del&gt;-&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;var&quot;&amp;gt;i&amp;lt;/span&amp;gt; &amp;amp;minus; &lt;/del&gt;1&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;j = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;i &lt;/ins&gt;- 1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;# {{I}}&#039;&#039;&#039;&lt;/del&gt;while&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039; &amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;j&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&lt;/del&gt;&amp;gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;gt; &lt;/del&gt;0 &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;&lt;/del&gt;and&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039; &amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;A&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt;&lt;/del&gt;[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;j&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt;&lt;/del&gt;] &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;gt; &amp;lt;span class=&quot;eoa-var&quot;&lt;/del&gt;&amp;gt;key&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;while j &amp;gt; 0 and A[j] &amp;gt; key&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;# {{I}}{{I}}&amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;A&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt;&lt;/del&gt;[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;j&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt; &lt;/del&gt;+ 1] = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;A&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt;&lt;/del&gt;[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;j&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt;&lt;/del&gt;]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;        &lt;/ins&gt;A[j + 1] = A[j]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;# {{I}}{{I}}&amp;lt;span class&lt;/del&gt;=&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;j&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt; = &amp;lt;span class=&quot;eoa&lt;/del&gt;-&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;var&quot;&amp;gt;j&amp;lt;/span&amp;gt; &amp;amp;minus; &lt;/del&gt;1&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;        j &lt;/ins&gt;= j - 1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;# {{I}}&amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;A&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt;&lt;/del&gt;[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;j&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt; &lt;/del&gt;+ 1] = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;span class=&quot;eoa-var&quot;&amp;gt;&lt;/del&gt;key&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/span&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;A[j + 1] = key&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Aitzaz</name></author>
	</entry>
	<entry>
		<id>https://eoa.aitzazimtiaz.xyz/index.php?title=Insertion_Sort&amp;diff=27&amp;oldid=prev</id>
		<title>Aitzaz: Created page with &quot;{{Infobox algorithm | name = Insertion sort | signature = &lt;span class=&quot;eoa-proc&quot;&gt;Insertion-Sort&lt;/span&gt;(&lt;span class=&quot;eoa-var&quot;&gt;A&lt;/span&gt;, &lt;span class=&quot;eoa-var&quot;&gt;n&lt;/span&gt;) | code = # &#039;&#039;&#039;for&#039;&#039;&#039; &lt;span class=&quot;eoa-var&quot;&gt;i&lt;/span&gt; = 2 &#039;&#039;&#039;to&#039;&#039;&#039; &lt;span class=&quot;eoa-var&quot;&gt;n&lt;/span&gt; # {{I}}&lt;span class=&quot;eoa-var&quot;&gt;key&lt;/span&gt; = &lt;span class=&quot;eoa-var&quot;&gt;A&lt;/span&gt;[&lt;span class=&quot;eoa-var&quot;&gt;i&lt;/span&gt;] # {{I}}&lt;span class=&quot;eoa-var&quot;&gt;j&lt;/span&gt; = &lt;span class=&quot;eoa-var&quot;&gt;i&lt;/span&gt; &amp;minus; 1 # {{I}}&#039;&#039;&#039;while&#039;&#039;&#039; &lt;span c...&quot;</title>
		<link rel="alternate" type="text/html" href="https://eoa.aitzazimtiaz.xyz/index.php?title=Insertion_Sort&amp;diff=27&amp;oldid=prev"/>
		<updated>2026-08-03T22:54:40Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Infobox algorithm | name = Insertion sort | signature = &amp;lt;span class=&amp;quot;eoa-proc&amp;quot;&amp;gt;Insertion-Sort&amp;lt;/span&amp;gt;(&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;A&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt;) | code = # &amp;#039;&amp;#039;&amp;#039;for&amp;#039;&amp;#039;&amp;#039; &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;i&amp;lt;/span&amp;gt; = 2 &amp;#039;&amp;#039;&amp;#039;to&amp;#039;&amp;#039;&amp;#039; &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt; # {{I}}&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;key&amp;lt;/span&amp;gt; = &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;A&amp;lt;/span&amp;gt;[&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;i&amp;lt;/span&amp;gt;] # {{I}}&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;j&amp;lt;/span&amp;gt; = &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;i&amp;lt;/span&amp;gt; − 1 # {{I}}&amp;#039;&amp;#039;&amp;#039;while&amp;#039;&amp;#039;&amp;#039; &amp;lt;span c...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Infobox algorithm&lt;br /&gt;
| name = Insertion sort&lt;br /&gt;
| signature = &amp;lt;span class=&amp;quot;eoa-proc&amp;quot;&amp;gt;Insertion-Sort&amp;lt;/span&amp;gt;(&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;A&amp;lt;/span&amp;gt;, &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt;)&lt;br /&gt;
| code =&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;for&amp;#039;&amp;#039;&amp;#039; &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;i&amp;lt;/span&amp;gt; = 2 &amp;#039;&amp;#039;&amp;#039;to&amp;#039;&amp;#039;&amp;#039; &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;n&amp;lt;/span&amp;gt;&lt;br /&gt;
# {{I}}&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;key&amp;lt;/span&amp;gt; = &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;A&amp;lt;/span&amp;gt;[&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;i&amp;lt;/span&amp;gt;]&lt;br /&gt;
# {{I}}&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;j&amp;lt;/span&amp;gt; = &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;i&amp;lt;/span&amp;gt; &amp;amp;minus; 1&lt;br /&gt;
# {{I}}&amp;#039;&amp;#039;&amp;#039;while&amp;#039;&amp;#039;&amp;#039; &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;j&amp;lt;/span&amp;gt; &amp;amp;gt; 0 &amp;#039;&amp;#039;&amp;#039;and&amp;#039;&amp;#039;&amp;#039; &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;A&amp;lt;/span&amp;gt;[&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;j&amp;lt;/span&amp;gt;] &amp;amp;gt; &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;key&amp;lt;/span&amp;gt;&lt;br /&gt;
# {{I}}{{I}}&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;A&amp;lt;/span&amp;gt;[&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;j&amp;lt;/span&amp;gt; + 1] = &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;A&amp;lt;/span&amp;gt;[&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;j&amp;lt;/span&amp;gt;]&lt;br /&gt;
# {{I}}{{I}}&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;j&amp;lt;/span&amp;gt; = &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;j&amp;lt;/span&amp;gt; &amp;amp;minus; 1&lt;br /&gt;
# {{I}}&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;A&amp;lt;/span&amp;gt;[&amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;j&amp;lt;/span&amp;gt; + 1] = &amp;lt;span class=&amp;quot;eoa-var&amp;quot;&amp;gt;key&amp;lt;/span&amp;gt;&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Aitzaz</name></author>
	</entry>
</feed>