<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.ninerpedia.org/index.php?action=history&amp;feed=atom&amp;title=Quick_sort</id>
	<title>Quick sort - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://www.ninerpedia.org/index.php?action=history&amp;feed=atom&amp;title=Quick_sort"/>
	<link rel="alternate" type="text/html" href="http://www.ninerpedia.org/index.php?title=Quick_sort&amp;action=history"/>
	<updated>2026-04-25T00:39:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://www.ninerpedia.org/index.php?title=Quick_sort&amp;diff=49432&amp;oldid=prev</id>
		<title>Stefan Haubenthal at 22:21, 20 June 2015</title>
		<link rel="alternate" type="text/html" href="http://www.ninerpedia.org/index.php?title=Quick_sort&amp;diff=49432&amp;oldid=prev"/>
		<updated>2015-06-20T22:21:20Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:21, 20 June 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l24&quot;&gt;Line 24:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 24:&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;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;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;       &amp;lt;code&amp;gt;&lt;/del&gt;Initialisation:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/code&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;Initialisation:&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;          &amp;lt;code&amp;gt;100 DIM A$(201)&amp;lt;/code&amp;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;          &amp;lt;code&amp;gt;100 DIM A$(201)&amp;lt;/code&amp;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;          &amp;lt;code&amp;gt;110 A=1&amp;lt;/code&amp;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;          &amp;lt;code&amp;gt;110 A=1&amp;lt;/code&amp;gt;&lt;/div&gt;&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-l32&quot;&gt;Line 32:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 32:&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;          &amp;lt;code&amp;gt;150 A$(201)=CHR$(124)&amp;lt;/code&amp;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;          &amp;lt;code&amp;gt;150 A$(201)=CHR$(124)&amp;lt;/code&amp;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;            &amp;lt;code&amp;gt;             &amp;lt;/code&amp;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;            &amp;lt;code&amp;gt;             &amp;lt;/code&amp;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;          &amp;lt;code&amp;gt;  &lt;/del&gt;{ program }&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/code&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;{ program }&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;              &amp;lt;code&amp;gt;          &amp;lt;/code&amp;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;              &amp;lt;code&amp;gt;          &amp;lt;/code&amp;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;         &amp;lt;code&amp;gt;2000 IF C-B&amp;lt;10 THEN 2320&amp;lt;/code&amp;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;         &amp;lt;code&amp;gt;2000 IF C-B&amp;lt;10 THEN 2320&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Stefan Haubenthal</name></author>
	</entry>
	<entry>
		<id>http://www.ninerpedia.org/index.php?title=Quick_sort&amp;diff=48456&amp;oldid=prev</id>
		<title>Stephen Shaw: Sorting routine for Basic programs</title>
		<link rel="alternate" type="text/html" href="http://www.ninerpedia.org/index.php?title=Quick_sort&amp;diff=48456&amp;oldid=prev"/>
		<updated>2014-09-16T19:19:54Z</updated>

		<summary type="html">&lt;p&gt;Sorting routine for Basic programs&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Sorting is often very useful. Here is a fast sorting routine in BASIC.&lt;br /&gt;
&lt;br /&gt;
QUICK SORT &lt;br /&gt;
&lt;br /&gt;
Sorting data is a frequent task for many programs, and it seems reasonable to use the fastest sorting method available.&lt;br /&gt;
&lt;br /&gt;
This sorting routine is very fast. &lt;br /&gt;
&lt;br /&gt;
The variables used are: &lt;br /&gt;
A,B,C,D,E, F(),  A$(), B$ &lt;br /&gt;
&lt;br /&gt;
To use the sort, your program must contain the initialisation lines (100-150) at the beginning. You should not use the above variables in the main program, but if necessary you can change the variable names in this routine to avoid conflict. &lt;br /&gt;
&lt;br /&gt;
The initialisation here is for 200 items. If you wish to sort a different number of items, set C to the number of items to be sorted (line 130) and DIMension A$ in line 100 to the number of items plus one. Then in line 150 set A$(Number of items plus one) to CHR$(124) (looks like | ) (press FCTN and A keys together). &lt;br /&gt;
&lt;br /&gt;
Your program may enter the routine with GOTO (EXIT with GOTO) or with GOSUB (EXIT with RETURN).&lt;br /&gt;
&lt;br /&gt;
The items to be sorted are to be placed in the array A$(), and when the routine is finished, the items will still be in the array, but in ascending order,depending on the ASCII codes of their letters. Note that A$(0) should NOT be used and left empty, it is used as a flag: &lt;br /&gt;
&lt;br /&gt;
Sorting order: eg AA after A, B after AZZZ and so on. &lt;br /&gt;
&lt;br /&gt;
This routine will sort up to 1000 items. After that, you will need to DIMension the F array- to F(11) for 2000 items, F(12) for 4000 items and so on. The default if you do not use DIM is (10). &lt;br /&gt;
 &lt;br /&gt;
        &lt;br /&gt;
 &lt;br /&gt;
       &amp;lt;code&amp;gt;Initialisation:&amp;lt;/code&amp;gt;&lt;br /&gt;
         &amp;lt;code&amp;gt;100 DIM A$(201)&amp;lt;/code&amp;gt;&lt;br /&gt;
         &amp;lt;code&amp;gt;110 A=1&amp;lt;/code&amp;gt;&lt;br /&gt;
         &amp;lt;code&amp;gt;120 B=1&amp;lt;/code&amp;gt;&lt;br /&gt;
         &amp;lt;code&amp;gt;130 C=200&amp;lt;/code&amp;gt;&lt;br /&gt;
         &amp;lt;code&amp;gt;140 A$(0)=&amp;quot; &amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
         &amp;lt;code&amp;gt;150 A$(201)=CHR$(124)&amp;lt;/code&amp;gt;&lt;br /&gt;
           &amp;lt;code&amp;gt;             &amp;lt;/code&amp;gt; &lt;br /&gt;
          &amp;lt;code&amp;gt;  { program }&amp;lt;/code&amp;gt; &lt;br /&gt;
             &amp;lt;code&amp;gt;          &amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2000 IF C-B&amp;lt;10 THEN 2320&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2010 D=B&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2020 E=C&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2030 B$=A$(B)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2040 IF B$&amp;gt;=A$(E)THEN 2070&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2050 E=E-1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2060 GOTO 2040&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2070 IF E&amp;gt;D THEN 2100&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2080 A$(D)=B$&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2090 GOTO 2190&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2100 A$(D)=A$(E)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2110 D=D+1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2120 IF A$(D)&amp;lt;B$ THEN 2110&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2130 IF E&amp;gt;D THEN 2170&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2140 A$(E)=B$&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2150 D=E&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2160 GOTO 2190&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2170 A$(E)=A$(D)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2180 GOTO 2050&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2190 IF C-D&amp;lt;D-B THEN 2260&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2200 F(A)=C&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2210 A=A+1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2220 F(A)=D+1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2230 A=A+1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2240 C=D-1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2250 GOTO 2000&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2260 F(A)=D-1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2270 A=A+1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2280 F(A)=B&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2290 A=A+1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2300 B=D+1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2310 GOTO 2000&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2320 E=B&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2330 E=E+1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2340 IF E&amp;gt;C THEN 2430&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2350 B$=A$(E)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2360 D=E-1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2370 IF A$(D)&amp;lt;=B$ THEN 2410&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2380 A$(D+1)=A$(D)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2390 D=D-1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2400 GOTO 2370&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2410 A$(D+1)=B$&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2420 GOTO 2330&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2430 IF A=1 THEN 2490&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2440 A=A-1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2450 B=F(A)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2460 A=A-1&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2470 C=F(A)&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2480 GOTO 2000&amp;lt;/code&amp;gt;&lt;br /&gt;
        &amp;lt;code&amp;gt;2490 RETURN   &amp;lt;/code&amp;gt;    &lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Stephen Shaw</name></author>
	</entry>
</feed>