<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.amstrad-cpc.net/index.php?action=history&amp;feed=atom&amp;title=Programming%3AQuicksort</id>
	<title>Programming:Quicksort - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.amstrad-cpc.net/index.php?action=history&amp;feed=atom&amp;title=Programming%3AQuicksort"/>
	<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming:Quicksort&amp;action=history"/>
	<updated>2026-09-04T01:11:25Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming:Quicksort&amp;diff=52901&amp;oldid=prev</id>
		<title>Litwr at 15:49, 7 February 2021</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming:Quicksort&amp;diff=52901&amp;oldid=prev"/>
		<updated>2021-02-07T15:49:14Z</updated>

		<summary type="html">&lt;p&gt;&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 15:49, 7 February 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Does a Quicksort (ascending) on a memory range in &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;44 &lt;/del&gt;bytes. An optimization for space is possible if you replace the absolute jumps with relative jumps (saves 6 bytes).&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;Does a Quicksort (ascending) on a memory range in &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;67 &lt;/ins&gt;bytes. An optimization for space is possible if you replace the absolute jumps with relative jumps (saves 6 bytes).&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;br&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;br&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;pre&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;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Litwr</name></author>
	</entry>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming:Quicksort&amp;diff=52900&amp;oldid=prev</id>
		<title>Octoate: Created page with &#039;Does a Quicksort (ascending) on a memory range in 44 bytes. An optimization for space is possible if you replace the absolute jumps with relative jumps (saves 6 bytes).  &lt;pre&gt; ; …&#039;</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming:Quicksort&amp;diff=52900&amp;oldid=prev"/>
		<updated>2009-09-23T16:16:20Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;Does a Quicksort (ascending) on a memory range in 44 bytes. An optimization for space is possible if you replace the absolute jumps with relative jumps (saves 6 bytes).  &amp;lt;pre&amp;gt; ; …&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Does a Quicksort (ascending) on a memory range in 44 bytes. An optimization for space is possible if you replace the absolute jumps with relative jumps (saves 6 bytes).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
;&lt;br /&gt;
; Usage: bc-&amp;gt;first, de-&amp;gt;last,&lt;br /&gt;
; call qsort&lt;br /&gt;
; Destroys: abcdefhl&lt;br /&gt;
;&lt;br /&gt;
qsort   ld      hl,0&lt;br /&gt;
        push    hl&lt;br /&gt;
qsloop  ld      h,b&lt;br /&gt;
        ld      l,c&lt;br /&gt;
        or      a&lt;br /&gt;
        sbc     hl,de&lt;br /&gt;
        jp      c,next1 ;loop until lo&amp;amp;lt;hi&lt;br /&gt;
        pop     bc&lt;br /&gt;
        ld      a,b&lt;br /&gt;
        or      c&lt;br /&gt;
        ret     z       ;bottom of stack&lt;br /&gt;
        pop     de&lt;br /&gt;
        jp      qsloop&lt;br /&gt;
next1   push    de      ;save hi,lo&lt;br /&gt;
        push    bc&lt;br /&gt;
        ld      a,(bc)  ;pivot&lt;br /&gt;
        ld      h,a&lt;br /&gt;
        dec     bc&lt;br /&gt;
        inc     de&lt;br /&gt;
fleft   inc     bc      ;do i++ while cur&amp;amp;lt;piv&lt;br /&gt;
        ld      a,(bc)&lt;br /&gt;
        cp      h&lt;br /&gt;
        jp      c,fleft&lt;br /&gt;
fright  dec     de      ;do i-- while cur&amp;gt;piv&lt;br /&gt;
        ld      a,(de)&lt;br /&gt;
        ld      l,a&lt;br /&gt;
        ld      a,h&lt;br /&gt;
        cp      l&lt;br /&gt;
        jp      c,fright&lt;br /&gt;
        push    hl      ;save pivot&lt;br /&gt;
        ld      h,d     ;exit if lo&amp;gt;hi&lt;br /&gt;
        ld      l,e&lt;br /&gt;
        or      a&lt;br /&gt;
        sbc     hl,bc&lt;br /&gt;
        jp      c,next2&lt;br /&gt;
        ld      a,(bc)  ;swap (bc),(de)&lt;br /&gt;
        ld      h,a&lt;br /&gt;
        ld      a,(de)&lt;br /&gt;
        ld      (bc),a&lt;br /&gt;
        ld      a,h&lt;br /&gt;
        ld      (de),a&lt;br /&gt;
        pop     hl      ;restore pivot&lt;br /&gt;
        jp      fleft&lt;br /&gt;
next2   pop     hl      ;restore pivot&lt;br /&gt;
        pop     hl      ;pop lo&lt;br /&gt;
        push    bc      ;stack=left-hi&lt;br /&gt;
        ld      b,h&lt;br /&gt;
        ld      c,l     ;bc=lo,de=right&lt;br /&gt;
        jp      qsloop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Octoate</name></author>
	</entry>
</feed>