Home » Personal collection » Acorn tapes » Electron_User » Electron_User_tape22a_acorn_eu_1991_may.wav » SrtEval

SrtEval

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn tapes » Electron_User » Electron_User_tape22a_acorn_eu_1991_may.wav
Filename: SrtEval
Read OK:
File size: 12D2 bytes
Load address: FFFF1A00
Exec address: FFFF8023
Duplicates

There are 3 duplicate copies of this file in the archive:

File contents
   10REM SORT EVALUATOR
   20REM by John Tissandier
   30REM (c) The Micro User
   40ON ERROR GOTO 200
   50MODE 7
   60PROCheading
   70PROCparameters
   80PROCcheck_progress
   90FOR set%=1 TO sets%
  100PRINT TAB(10,3);set%
  110PROCcreate_data
  120FOR sort%=1 TO sorts%
  130PROCcall_sort
  140NEXT
  150NEXT
  160PROCdisplay_results
  170@%=field%
  180END
  190:
  200REM Error routine
  210VDU 3,7
  220CLOSE#0
  230MODE 7
  240REPORT:PRINT " at line ";ERL
  250END
  260:
  270REM ++ DATA ++
  280:
  290DATA 3
  300DATA Bubble,Quick,Shell
  310:
  320DEFPROCheading
  330LOCAL i%
  340FOR i%=0 TO 1
  350PRINTTAB(7,i%)CHR$141CHR$134CHR$157CHR$(129)" SORT EVALUATOR"SPC3CHR$156
  360NEXT
  370VDU 28,0,24,39,4
  380ENDPROC
  390:
  400DEF PROCparameters
  410LOCAL i%,method$,n%
  420INPUT "Number of items to sort: 2^" points%
  430IF points%<1 points%=5:PRINT'CHR$(129);"Default = 2^";points%
  440items%=2^points%
  450DIM unsorted%(items%),data%(items%)
  460INPUT'"Number of data sets: " sets%
  470IF sets%<2 sets%=2:PRINT'CHR$(129);"Minimum = 2"
  480READ n%
  490DIM method$(n%)
  500sorts%=0
  510FOR i%=1 TO n%
  520READ method$
  530IF NOT (i%=n% AND sorts%=0) IF FNinput("Include "+method$+" Sort") sorts%=sorts%+1:method$(sorts%)=method$
  540IF i%=n% AND sorts%=0 method$(1)=method$:sorts%=sorts%+1:PRINT'CHR$129method$" Sort included"
  550NEXT
  560DIM time%(sorts%,points%,sets%)
  570output=FNinput("Display output from sort")
  580printer=FNinput("Send to printer")
  590write=FNinput("Save to disc")
  600field%=@%:@%=&09:len%=0
  610ENDPROC
  620:
  630DEF FNinput(prompt$)
  640PRINT'prompt$"? ";
  650*FX21
  660IF INSTR("Yy",GET$) PRINT "Y":=TRUE ELSE PRINT "N":=FALSE
  670:
  680DEF PROCcheck_progress
  690VDU 23,1,0;0;0;0;26,12
  700PRINT'CHR$136"SORTING"
  710PRINTTAB(0,3)"Data set: "
  720PRINTTAB(0,5)"Method:"
  730PRINTTAB(0,7)"Number of items: "
  740ENDPROC
  750:
  760DEF PROCcreate_data
  770LOCAL i%
  780FOR i%=1 TO items%
  790unsorted%(i%)=RND(9999)
  800NEXT
  810ENDPROC
  820:
  830DEF PROCcall_sort
  840LOCAL method$,point%,t%
  850method$=method$(sort%)
  860len%=len%-LEN(method$):IF len%<0 len%=0
  870PRINTTAB(8,5)method$SPClen%
  880len%=LEN(method$)
  890FOR point%=1 TO points%
  900items%=2^point%
  910PRINTTAB(17,7);items%SPC9
  920PROCinit_array
  930TIME=0:Z%=EVAL("FN"+method$+"(items%)"):t%=TIME
  940time%(sort%,point%,set%)=t%
  950IF output THEN PROCoutput
  960NEXT
  970ENDPROC
  980:
  990DEF PROCinit_array
 1000LOCAL i%
 1010FOR i%=1 TO items%
 1020data%(i%)=unsorted%(i%)
 1030NEXT
 1040ENDPROC
 1050:
 1060DEF PROCoutput
 1070LOCAL i%
 1080PRINTTAB(0,1)CHR$137
 1090IF points%>3 VDU14:PRINTTAB(0,24)"Press SHIFT to continue";
 1100VDU 28,0,22,39,9
 1110FOR i%=1 TO items%
 1120PRINT data%(i%);
 1130IF i%<>items% PRINT
 1140NEXT
 1150VDU 15,26
 1160PROCspace
 1170VDU 28,0,24,39,9,12,26
 1180PRINTTAB(0,1)CHR$136
 1190ENDPROC
 1200:
 1210DEF PROCspace
 1220*FX21
 1230PRINTTAB(0,24)"Press SPACE to continue";
 1240REPEAT UNTIL GET=32
 1250ENDPROC
 1260:
 1270DEF PROCdisplay_results
 1280LOCAL quit
 1290REPEAT
 1300FOR sort%=1 TO sorts%
 1310PROCresults
 1320NEXT
 1330write=FALSE:printer=FALSE
 1340IF sorts%>1 VDU 31,0,22,23,1,1;0;0;0;:quit=NOT FNinput("Display results again") ELSE quit=TRUE
 1350IF quit VDU 23,1,1;0;0;0; ELSE VDU 23,1,0;0;0;0;
 1360UNTIL quit
 1370ENDPROC
 1380:
 1390DEF PROCresults
 1400LOCAL fname$,min_time%,max_time,max_time%,mean_time%,point%
 1410CLS
 1420IF printer VDU 2,13,13
 1430PRINT'method$(sort%)" Sort (times in centiseconds)"
 1440PRINT'"No. items"SPC6"Min"SPC6"Max"SPC5"Mean"'
 1450IF write fname$="I."+LEFT$(method$(sort%),7):chan%=OPENOUT(fname$):BPUT#chan%,48:BPUT#chan%,44:BPUT#chan%,48:BPUT#chan%,44
 1460FOR point%=1 TO points%
 1470min_time%=FNcalculate("min",point%)
 1480max_time%=FNcalculate("max",point%)
 1490mean_time=FNcalculate("mean",point%)/sets%:mean_time%=INT(mean_time):IF mean_time-mean_time%>=0.5 mean_time%=mean_time%+1
 1500PRINT 2^point%,min_time%,max_time%,mean_time%
 1510IF write PROCwrite(2^point%):PROCwrite(mean_time%)
 1520NEXT
 1530VDU 3
 1540IF write CLOSE#chan%:PRINT'"Filename: ";fname$
 1550IF sorts%>1 AND sort%<>sorts% AND printer=FALSE PROCspace
 1560ENDPROC
 1570:
 1580DEF FNcalculate(m$,p%)
 1590LOCAL set%,result%,time%
 1600IF m$="min" result%=2147483647 ELSE result%=0
 1610FOR set%=1 TO sets%
 1620time%=time%(sort%,p%,set%)
 1630IF m$="min" IF time%<result% result%=time%
 1640IF m$="max" IF time%>result% result%=time%
 1650IF m$="mean" result%=result%+time%
 1660NEXT
 1670=result%
 1680:
 1690DEF PROCwrite(val%)
 1700LOCAL byte%,char%,str$
 1710str$=STR$(val%)
 1720FOR char%=1 TO LEN(str$)
 1730byte%=ASCMID$(str$,char%)
 1740BPUT#chan%,byte%
 1750NEXT
 1760BPUT#chan%,ASC","
 1770ENDPROC
 1780:
 1790REM ++ SWAP PROCEDURE ++
 1800:
 1810DEF PROCswap(a%,b%)
 1820LOCAL temp%
 1830temp%=data%(a%)
 1840data%(a%)=data%(b%)
 1850data%(b%)=temp%
 1860ENDPROC
 1870:
 1880REM ++ BUBBLE SORT ++
 1890:
 1900DEF FNBubble(n%)
 1910PROCbubble(n%):=0
 1920:
 1930DEF PROCbubble(n%)
 1940LOCAL i%,j%,swap
 1950i%=0
 1960REPEAT
 1970i%=i%+1
 1980swap=FALSE
 1990FOR j%=n% TO i%+1 STEP -1
 2000IF data%(j%)<data%(j%-1) PROCswap(j%,j%-1):swap=TRUE
 2010NEXT
 2020UNTIL swap=FALSE OR i%=n%-1
 2030ENDPROC
 2040:
 2050REM ++ QUICK SORT ++
 2060:
 2070DEF FNQuick(rhi%)
 2080PROCquick(1,rhi%):=0
 2090:
 2100DEF PROCquick(llo%,rhi%)
 2110LOCAL mid%,lhi%,rlo%
 2120mid%=data%((llo%+rhi%) DIV 2)
 2130lhi%=rhi%:rlo%=llo%
 2140REPEAT
 2150IF data%(rlo%)<mid% REPEAT:rlo%=rlo%+1:UNTIL data%(rlo%)>=mid%
 2160IF data%(lhi%)>mid% REPEAT:lhi%=lhi%-1:UNTIL data%(lhi%)<=mid%
 2170IF rlo%<=lhi% PROCswap(rlo%,lhi%):lhi%=lhi%-1:rlo%=rlo%+1
 2180UNTIL rlo%>lhi%
 2190IF llo%<lhi% PROCquick(llo%,lhi%)
 2200IF rlo%<rhi% PROCquick(rlo%,rhi%)
 2210ENDPROC
 2220:
 2230REM ++ SHELL SORT ++
 2240:
 2250DEF FNShell(n%)
 2260PROCshell(n%):=0
 2270:
 2280DEF PROCshell(n%)
 2290LOCAL hi%,i%,int%,lo%,swap
 2300int%=n%
 2310REPEAT
 2320int%=int% DIV 2
 2330FOR i%=1 TO n%-int%
 2340lo%=i%:hi%=int%+i%
 2350REPEAT
 2360swap=FALSE
 2370IF data%(hi%)<data%(lo%) PROCswap(hi%,lo%):hi%=lo%:lo%=lo%-int%:swap=TRUE
 2380UNTIL swap=FALSE OR lo%<=0
 2390NEXT
 2400UNTIL int%<=0
 2410ENDPROC

� SORT EVALUATOR
� by John Tissandier
� (c) The Micro User
(� � � �dH@
2� 7
<�heading
F�parameters
P�check_progress
Z� set%=1 � sets%
d� �10,3);set%
n�create_data
x� sort%=1 � sorts%
��call_sort
��
��
��display_results
�
@%=field%
��
�:
�� Error routine
�	� 3,7
��#0
�� 7
��:� " at line ";�
��
:
� ++ DATA ++
:
"� 3
,� Bubble,Quick,Shell
6:
@
��heading
J� i%
T� i%=0 � 1
^4�7,i%)�141�134�157�(129)" SORT EVALUATOR"�3�156
h�
r� 28,0,24,39,4
|�
�:
�� �parameters
�� i%,method$,n%
�+� "Number of items to sort: 2^" points%
�9� points%<1 points%=5:�'�(129);"Default = 2^";points%
�items%=2^points%
�%� unsorted%(items%),data%(items%)
�#�'"Number of data sets: " sets%
�,� sets%<2 sets%=2:�'�(129);"Minimum = 2"
�� n%
�� method$(n%)
�sorts%=0
�� i%=1 � n%

� method$
g� � (i%=n% � sorts%=0) � �input("Include "+method$+" Sort") sorts%=sorts%+1:method$(sorts%)=method$
W� i%=n% � sorts%=0 method$(1)=method$:sorts%=sorts%+1:�'�129method$" Sort included"
&�
0!� time%(sorts%,points%,sets%)
:-output=�input("Display output from sort")
D%printer=�input("Send to printer")
N write=�input("Save to disc")
Xfield%=@%:@%=&09:len%=0
b�
l:
v� �input(prompt$)
��'prompt$"? ";
�	*FX21
�"� �"Yy",�) � "Y":=� � � "N":=�
�:
�� �check_progress
�� 23,1,0;0;0;0;26,12
��'�136"SORTING"
��0,3)"Data set: "
��0,5)"Method:"
��0,7)"Number of items: "
��
�:
�� �create_data
� i%
� i%=1 � items%
unsorted%(i%)=�(9999)
 �
*�
4:
>� �call_sort
H� method$,point%,t%
Rmethod$=method$(sort%)
\(len%=len%-�(method$):� len%<0 len%=0
f�8,5)method$�len%
plen%=�(method$)
z� point%=1 � points%
�items%=2^point%
��17,7);items%�9
��init_array
�*�=0:Z%=�("FN"+method$+"(items%)"):t%=�
�time%(sort%,point%,set%)=t%
�� output � �output
��
��
�:
�� �init_array
�� i%
�� i%=1 � items%
�data%(i%)=unsorted%(i%)
�
�
:
$
� �output
.� i%
8�0,1)�137
B5� points%>3 �14:�0,24)"Press SHIFT to continue";
L� 28,0,22,39,9
V� i%=1 � items%
`� data%(i%);
j� i%<>items% �
t�
~� 15,26
�
�space
�� 28,0,24,39,9,12,26
��0,1)�136
��
�:
�� �space
�	*FX21
�%�0,24)"Press SPACE to continue";
�� � �=32
��
�:
�� �display_results

� quit

�
� sort%=1 � sorts%
�results
(�
2write=�:printer=�
<V� sorts%>1 � 31,0,22,23,1,1;0;0;0;:quit=� �input("Display results again") � quit=�
F,� quit � 23,1,1;0;0;0; � � 23,1,0;0;0;0;
P
� quit
Z�
d:
n� �results
x;� fname$,min_time%,max_time,max_time%,mean_time%,point%
��
�� printer � 2,13,13
�3�'method$(sort%)" Sort (times in centiseconds)"
�(�'"No. items"�6"Min"�6"Max"�5"Mean"'
�f� write fname$="I."+�method$(sort%),7):chan%=�(fname$):�#chan%,48:�#chan%,44:�#chan%,48:�#chan%,44
�� point%=1 � points%
�&min_time%=�calculate("min",point%)
�&max_time%=�calculate("max",point%)
�ymean_time=�calculate("mean",point%)/sets%:mean_time%=�(mean_time):� mean_time-mean_time%>=0.5 mean_time%=mean_time%+1
�-� 2^point%,min_time%,max_time%,mean_time%
�/� write �write(2^point%):�write(mean_time%)
��
�� 3
)� write �#chan%:�'"Filename: ";fname$
1� sorts%>1 � sort%<>sorts% � printer=� �space
�
":
,� �calculate(m$,p%)
6� set%,result%,time%
@-� m$="min" result%=2147483647 � result%=0
J� set%=1 � sets%
Ttime%=time%(sort%,p%,set%)
^,� m$="min" � time%<result% result%=time%
h,� m$="max" � time%>result% result%=time%
r%� m$="mean" result%=result%+time%
|�
�=result%
�:
�� �write(val%)
�� byte%,char%,str$
�str$=�(val%)
�� char%=1 � �(str$)
�byte%=��str$,char%)
��#chan%,byte%
��
��#chan%,�","
��
�:
�� ++ SWAP PROCEDURE ++
:
� �swap(a%,b%)
� temp%
&temp%=data%(a%)
0data%(a%)=data%(b%)
:data%(b%)=temp%
D�
N:
X� ++ BUBBLE SORT ++
b:
l� �Bubble(n%)
v�bubble(n%):=0
�:
�� �bubble(n%)
�� i%,j%,swap
�i%=0
��
�i%=i%+1
�
swap=�
�� j%=n% � i%+1 � -1
�1� data%(j%)<data%(j%-1) �swap(j%,j%-1):swap=�
��
�� swap=� � i%=n%-1
��
�:
� ++ QUICK SORT ++
:
� �Quick(rhi%)
 �quick(1,rhi%):=0
*:
4� �quick(llo%,rhi%)
>� mid%,lhi%,rlo%
Hmid%=data%((llo%+rhi%) � 2)
Rlhi%=rhi%:rlo%=llo%
\�
f8� data%(rlo%)<mid% �:rlo%=rlo%+1:� data%(rlo%)>=mid%
p8� data%(lhi%)>mid% �:lhi%=lhi%-1:� data%(lhi%)<=mid%
z9� rlo%<=lhi% �swap(rlo%,lhi%):lhi%=lhi%-1:rlo%=rlo%+1
�� rlo%>lhi%
�!� llo%<lhi% �quick(llo%,lhi%)
�!� rlo%<rhi% �quick(rlo%,rhi%)
��
�:
�� ++ SHELL SORT ++
�:
�� �Shell(n%)
��shell(n%):=0
�:
�� �shell(n%)
�� hi%,i%,int%,lo%,swap
�int%=n%
	�
	int%=int% � 2
	� i%=1 � n%-int%
	$lo%=i%:hi%=int%+i%
	.�
	8
swap=�
	BF� data%(hi%)<data%(lo%) �swap(hi%,lo%):hi%=lo%:lo%=lo%-int%:swap=�
	L� swap=� � lo%<=0
	V�
	`
� int%<=0
	j�
�
00000000  0d 00 0a 14 f4 20 53 4f  52 54 20 45 56 41 4c 55  |..... SORT EVALU|
00000010  41 54 4f 52 0d 00 14 18  f4 20 62 79 20 4a 6f 68  |ATOR..... by Joh|
00000020  6e 20 54 69 73 73 61 6e  64 69 65 72 0d 00 1e 18  |n Tissandier....|
00000030  f4 20 28 63 29 20 54 68  65 20 4d 69 63 72 6f 20  |. (c) The Micro |
00000040  55 73 65 72 0d 00 28 0e  ee 20 85 20 e5 20 8d 64  |User..(.. . . .d|
00000050  48 40 0d 00 32 07 eb 20  37 0d 00 3c 0c f2 68 65  |H@..2.. 7..<..he|
00000060  61 64 69 6e 67 0d 00 46  0f f2 70 61 72 61 6d 65  |ading..F..parame|
00000070  74 65 72 73 0d 00 50 13  f2 63 68 65 63 6b 5f 70  |ters..P..check_p|
00000080  72 6f 67 72 65 73 73 0d  00 5a 14 e3 20 73 65 74  |rogress..Z.. set|
00000090  25 3d 31 20 b8 20 73 65  74 73 25 0d 00 64 11 f1  |%=1 . sets%..d..|
000000a0  20 8a 31 30 2c 33 29 3b  73 65 74 25 0d 00 6e 10  | .10,3);set%..n.|
000000b0  f2 63 72 65 61 74 65 5f  64 61 74 61 0d 00 78 16  |.create_data..x.|
000000c0  e3 20 73 6f 72 74 25 3d  31 20 b8 20 73 6f 72 74  |. sort%=1 . sort|
000000d0  73 25 0d 00 82 0e f2 63  61 6c 6c 5f 73 6f 72 74  |s%.....call_sort|
000000e0  0d 00 8c 05 ed 0d 00 96  05 ed 0d 00 a0 14 f2 64  |...............d|
000000f0  69 73 70 6c 61 79 5f 72  65 73 75 6c 74 73 0d 00  |isplay_results..|
00000100  aa 0d 40 25 3d 66 69 65  6c 64 25 0d 00 b4 05 e0  |..@%=field%.....|
00000110  0d 00 be 05 3a 0d 00 c8  13 f4 20 45 72 72 6f 72  |....:..... Error|
00000120  20 72 6f 75 74 69 6e 65  0d 00 d2 09 ef 20 33 2c  | routine..... 3,|
00000130  37 0d 00 dc 07 d9 23 30  0d 00 e6 07 eb 20 37 0d  |7.....#0..... 7.|
00000140  00 f0 15 f6 3a f1 20 22  20 61 74 20 6c 69 6e 65  |....:. " at line|
00000150  20 22 3b 9e 0d 00 fa 05  e0 0d 01 04 05 3a 0d 01  | ";..........:..|
00000160  0e 10 f4 20 2b 2b 20 44  41 54 41 20 2b 2b 0d 01  |... ++ DATA ++..|
00000170  18 05 3a 0d 01 22 07 dc  20 33 0d 01 2c 18 dc 20  |..:..".. 3..,.. |
00000180  42 75 62 62 6c 65 2c 51  75 69 63 6b 2c 53 68 65  |Bubble,Quick,She|
00000190  6c 6c 0d 01 36 05 3a 0d  01 40 0d dd f2 68 65 61  |ll..6.:..@...hea|
000001a0  64 69 6e 67 0d 01 4a 08  ea 20 69 25 0d 01 54 0e  |ding..J.. i%..T.|
000001b0  e3 20 69 25 3d 30 20 b8  20 31 0d 01 5e 34 f1 8a  |. i%=0 . 1..^4..|
000001c0  37 2c 69 25 29 bd 31 34  31 bd 31 33 34 bd 31 35  |7,i%).141.134.15|
000001d0  37 bd 28 31 32 39 29 22  20 53 4f 52 54 20 45 56  |7.(129)" SORT EV|
000001e0  41 4c 55 41 54 4f 52 22  89 33 bd 31 35 36 0d 01  |ALUATOR".3.156..|
000001f0  68 05 ed 0d 01 72 12 ef  20 32 38 2c 30 2c 32 34  |h....r.. 28,0,24|
00000200  2c 33 39 2c 34 0d 01 7c  05 e1 0d 01 86 05 3a 0d  |,39,4..|......:.|
00000210  01 90 11 dd 20 f2 70 61  72 61 6d 65 74 65 72 73  |.... .parameters|
00000220  0d 01 9a 13 ea 20 69 25  2c 6d 65 74 68 6f 64 24  |..... i%,method$|
00000230  2c 6e 25 0d 01 a4 2b e8  20 22 4e 75 6d 62 65 72  |,n%...+. "Number|
00000240  20 6f 66 20 69 74 65 6d  73 20 74 6f 20 73 6f 72  | of items to sor|
00000250  74 3a 20 32 5e 22 20 70  6f 69 6e 74 73 25 0d 01  |t: 2^" points%..|
00000260  ae 39 e7 20 70 6f 69 6e  74 73 25 3c 31 20 70 6f  |.9. points%<1 po|
00000270  69 6e 74 73 25 3d 35 3a  f1 27 bd 28 31 32 39 29  |ints%=5:.'.(129)|
00000280  3b 22 44 65 66 61 75 6c  74 20 3d 20 32 5e 22 3b  |;"Default = 2^";|
00000290  70 6f 69 6e 74 73 25 0d  01 b8 14 69 74 65 6d 73  |points%....items|
000002a0  25 3d 32 5e 70 6f 69 6e  74 73 25 0d 01 c2 25 de  |%=2^points%...%.|
000002b0  20 75 6e 73 6f 72 74 65  64 25 28 69 74 65 6d 73  | unsorted%(items|
000002c0  25 29 2c 64 61 74 61 25  28 69 74 65 6d 73 25 29  |%),data%(items%)|
000002d0  0d 01 cc 23 e8 27 22 4e  75 6d 62 65 72 20 6f 66  |...#.'"Number of|
000002e0  20 64 61 74 61 20 73 65  74 73 3a 20 22 20 73 65  | data sets: " se|
000002f0  74 73 25 0d 01 d6 2c e7  20 73 65 74 73 25 3c 32  |ts%...,. sets%<2|
00000300  20 73 65 74 73 25 3d 32  3a f1 27 bd 28 31 32 39  | sets%=2:.'.(129|
00000310  29 3b 22 4d 69 6e 69 6d  75 6d 20 3d 20 32 22 0d  |);"Minimum = 2".|
00000320  01 e0 08 f3 20 6e 25 0d  01 ea 11 de 20 6d 65 74  |.... n%..... met|
00000330  68 6f 64 24 28 6e 25 29  0d 01 f4 0c 73 6f 72 74  |hod$(n%)....sort|
00000340  73 25 3d 30 0d 01 fe 0f  e3 20 69 25 3d 31 20 b8  |s%=0..... i%=1 .|
00000350  20 6e 25 0d 02 08 0d f3  20 6d 65 74 68 6f 64 24  | n%..... method$|
00000360  0d 02 12 67 e7 20 ac 20  28 69 25 3d 6e 25 20 80  |...g. . (i%=n% .|
00000370  20 73 6f 72 74 73 25 3d  30 29 20 e7 20 a4 69 6e  | sorts%=0) . .in|
00000380  70 75 74 28 22 49 6e 63  6c 75 64 65 20 22 2b 6d  |put("Include "+m|
00000390  65 74 68 6f 64 24 2b 22  20 53 6f 72 74 22 29 20  |ethod$+" Sort") |
000003a0  73 6f 72 74 73 25 3d 73  6f 72 74 73 25 2b 31 3a  |sorts%=sorts%+1:|
000003b0  6d 65 74 68 6f 64 24 28  73 6f 72 74 73 25 29 3d  |method$(sorts%)=|
000003c0  6d 65 74 68 6f 64 24 0d  02 1c 57 e7 20 69 25 3d  |method$...W. i%=|
000003d0  6e 25 20 80 20 73 6f 72  74 73 25 3d 30 20 6d 65  |n% . sorts%=0 me|
000003e0  74 68 6f 64 24 28 31 29  3d 6d 65 74 68 6f 64 24  |thod$(1)=method$|
000003f0  3a 73 6f 72 74 73 25 3d  73 6f 72 74 73 25 2b 31  |:sorts%=sorts%+1|
00000400  3a f1 27 bd 31 32 39 6d  65 74 68 6f 64 24 22 20  |:.'.129method$" |
00000410  53 6f 72 74 20 69 6e 63  6c 75 64 65 64 22 0d 02  |Sort included"..|
00000420  26 05 ed 0d 02 30 21 de  20 74 69 6d 65 25 28 73  |&....0!. time%(s|
00000430  6f 72 74 73 25 2c 70 6f  69 6e 74 73 25 2c 73 65  |orts%,points%,se|
00000440  74 73 25 29 0d 02 3a 2d  6f 75 74 70 75 74 3d a4  |ts%)..:-output=.|
00000450  69 6e 70 75 74 28 22 44  69 73 70 6c 61 79 20 6f  |input("Display o|
00000460  75 74 70 75 74 20 66 72  6f 6d 20 73 6f 72 74 22  |utput from sort"|
00000470  29 0d 02 44 25 70 72 69  6e 74 65 72 3d a4 69 6e  |)..D%printer=.in|
00000480  70 75 74 28 22 53 65 6e  64 20 74 6f 20 70 72 69  |put("Send to pri|
00000490  6e 74 65 72 22 29 0d 02  4e 20 77 72 69 74 65 3d  |nter")..N write=|
000004a0  a4 69 6e 70 75 74 28 22  53 61 76 65 20 74 6f 20  |.input("Save to |
000004b0  64 69 73 63 22 29 0d 02  58 1b 66 69 65 6c 64 25  |disc")..X.field%|
000004c0  3d 40 25 3a 40 25 3d 26  30 39 3a 6c 65 6e 25 3d  |=@%:@%=&09:len%=|
000004d0  30 0d 02 62 05 e1 0d 02  6c 05 3a 0d 02 76 15 dd  |0..b....l.:..v..|
000004e0  20 a4 69 6e 70 75 74 28  70 72 6f 6d 70 74 24 29  | .input(prompt$)|
000004f0  0d 02 80 12 f1 27 70 72  6f 6d 70 74 24 22 3f 20  |.....'prompt$"? |
00000500  22 3b 0d 02 8a 09 2a 46  58 32 31 0d 02 94 22 e7  |";....*FX21...".|
00000510  20 a7 22 59 79 22 2c be  29 20 f1 20 22 59 22 3a  | ."Yy",.) . "Y":|
00000520  3d b9 20 8b 20 f1 20 22  4e 22 3a 3d a3 0d 02 9e  |=. . . "N":=....|
00000530  05 3a 0d 02 a8 15 dd 20  f2 63 68 65 63 6b 5f 70  |.:..... .check_p|
00000540  72 6f 67 72 65 73 73 0d  02 b2 18 ef 20 32 33 2c  |rogress..... 23,|
00000550  31 2c 30 3b 30 3b 30 3b  30 3b 32 36 2c 31 32 0d  |1,0;0;0;0;26,12.|
00000560  02 bc 13 f1 27 bd 31 33  36 22 53 4f 52 54 49 4e  |....'.136"SORTIN|
00000570  47 22 0d 02 c6 16 f1 8a  30 2c 33 29 22 44 61 74  |G"......0,3)"Dat|
00000580  61 20 73 65 74 3a 20 22  0d 02 d0 13 f1 8a 30 2c  |a set: "......0,|
00000590  35 29 22 4d 65 74 68 6f  64 3a 22 0d 02 da 1d f1  |5)"Method:".....|
000005a0  8a 30 2c 37 29 22 4e 75  6d 62 65 72 20 6f 66 20  |.0,7)"Number of |
000005b0  69 74 65 6d 73 3a 20 22  0d 02 e4 05 e1 0d 02 ee  |items: "........|
000005c0  05 3a 0d 02 f8 12 dd 20  f2 63 72 65 61 74 65 5f  |.:..... .create_|
000005d0  64 61 74 61 0d 03 02 08  ea 20 69 25 0d 03 0c 13  |data..... i%....|
000005e0  e3 20 69 25 3d 31 20 b8  20 69 74 65 6d 73 25 0d  |. i%=1 . items%.|
000005f0  03 16 19 75 6e 73 6f 72  74 65 64 25 28 69 25 29  |...unsorted%(i%)|
00000600  3d b3 28 39 39 39 39 29  0d 03 20 05 ed 0d 03 2a  |=.(9999).. ....*|
00000610  05 e1 0d 03 34 05 3a 0d  03 3e 10 dd 20 f2 63 61  |....4.:..>.. .ca|
00000620  6c 6c 5f 73 6f 72 74 0d  03 48 17 ea 20 6d 65 74  |ll_sort..H.. met|
00000630  68 6f 64 24 2c 70 6f 69  6e 74 25 2c 74 25 0d 03  |hod$,point%,t%..|
00000640  52 1a 6d 65 74 68 6f 64  24 3d 6d 65 74 68 6f 64  |R.method$=method|
00000650  24 28 73 6f 72 74 25 29  0d 03 5c 28 6c 65 6e 25  |$(sort%)..\(len%|
00000660  3d 6c 65 6e 25 2d a9 28  6d 65 74 68 6f 64 24 29  |=len%-.(method$)|
00000670  3a e7 20 6c 65 6e 25 3c  30 20 6c 65 6e 25 3d 30  |:. len%<0 len%=0|
00000680  0d 03 66 16 f1 8a 38 2c  35 29 6d 65 74 68 6f 64  |..f...8,5)method|
00000690  24 89 6c 65 6e 25 0d 03  70 13 6c 65 6e 25 3d a9  |$.len%..p.len%=.|
000006a0  28 6d 65 74 68 6f 64 24  29 0d 03 7a 18 e3 20 70  |(method$)..z.. p|
000006b0  6f 69 6e 74 25 3d 31 20  b8 20 70 6f 69 6e 74 73  |oint%=1 . points|
000006c0  25 0d 03 84 13 69 74 65  6d 73 25 3d 32 5e 70 6f  |%....items%=2^po|
000006d0  69 6e 74 25 0d 03 8e 14  f1 8a 31 37 2c 37 29 3b  |int%......17,7);|
000006e0  69 74 65 6d 73 25 89 39  0d 03 98 0f f2 69 6e 69  |items%.9.....ini|
000006f0  74 5f 61 72 72 61 79 0d  03 a2 2a d1 3d 30 3a 5a  |t_array...*.=0:Z|
00000700  25 3d a0 28 22 46 4e 22  2b 6d 65 74 68 6f 64 24  |%=.("FN"+method$|
00000710  2b 22 28 69 74 65 6d 73  25 29 22 29 3a 74 25 3d  |+"(items%)"):t%=|
00000720  91 0d 03 ac 1f 74 69 6d  65 25 28 73 6f 72 74 25  |.....time%(sort%|
00000730  2c 70 6f 69 6e 74 25 2c  73 65 74 25 29 3d 74 25  |,point%,set%)=t%|
00000740  0d 03 b6 16 e7 20 6f 75  74 70 75 74 20 8c 20 f2  |..... output . .|
00000750  6f 75 74 70 75 74 0d 03  c0 05 ed 0d 03 ca 05 e1  |output..........|
00000760  0d 03 d4 05 3a 0d 03 de  11 dd 20 f2 69 6e 69 74  |....:..... .init|
00000770  5f 61 72 72 61 79 0d 03  e8 08 ea 20 69 25 0d 03  |_array..... i%..|
00000780  f2 13 e3 20 69 25 3d 31  20 b8 20 69 74 65 6d 73  |... i%=1 . items|
00000790  25 0d 03 fc 1b 64 61 74  61 25 28 69 25 29 3d 75  |%....data%(i%)=u|
000007a0  6e 73 6f 72 74 65 64 25  28 69 25 29 0d 04 06 05  |nsorted%(i%)....|
000007b0  ed 0d 04 10 05 e1 0d 04  1a 05 3a 0d 04 24 0d dd  |..........:..$..|
000007c0  20 f2 6f 75 74 70 75 74  0d 04 2e 08 ea 20 69 25  | .output..... i%|
000007d0  0d 04 38 0e f1 8a 30 2c  31 29 bd 31 33 37 0d 04  |..8...0,1).137..|
000007e0  42 35 e7 20 70 6f 69 6e  74 73 25 3e 33 20 ef 31  |B5. points%>3 .1|
000007f0  34 3a f1 8a 30 2c 32 34  29 22 50 72 65 73 73 20  |4:..0,24)"Press |
00000800  53 48 49 46 54 20 74 6f  20 63 6f 6e 74 69 6e 75  |SHIFT to continu|
00000810  65 22 3b 0d 04 4c 12 ef  20 32 38 2c 30 2c 32 32  |e";..L.. 28,0,22|
00000820  2c 33 39 2c 39 0d 04 56  13 e3 20 69 25 3d 31 20  |,39,9..V.. i%=1 |
00000830  b8 20 69 74 65 6d 73 25  0d 04 60 10 f1 20 64 61  |. items%..`.. da|
00000840  74 61 25 28 69 25 29 3b  0d 04 6a 12 e7 20 69 25  |ta%(i%);..j.. i%|
00000850  3c 3e 69 74 65 6d 73 25  20 f1 0d 04 74 05 ed 0d  |<>items% ...t...|
00000860  04 7e 0b ef 20 31 35 2c  32 36 0d 04 88 0a f2 73  |.~.. 15,26.....s|
00000870  70 61 63 65 0d 04 92 18  ef 20 32 38 2c 30 2c 32  |pace..... 28,0,2|
00000880  34 2c 33 39 2c 39 2c 31  32 2c 32 36 0d 04 9c 0e  |4,39,9,12,26....|
00000890  f1 8a 30 2c 31 29 bd 31  33 36 0d 04 a6 05 e1 0d  |..0,1).136......|
000008a0  04 b0 05 3a 0d 04 ba 0c  dd 20 f2 73 70 61 63 65  |...:..... .space|
000008b0  0d 04 c4 09 2a 46 58 32  31 0d 04 ce 25 f1 8a 30  |....*FX21...%..0|
000008c0  2c 32 34 29 22 50 72 65  73 73 20 53 50 41 43 45  |,24)"Press SPACE|
000008d0  20 74 6f 20 63 6f 6e 74  69 6e 75 65 22 3b 0d 04  | to continue";..|
000008e0  d8 0c f5 20 fd 20 a5 3d  33 32 0d 04 e2 05 e1 0d  |... . .=32......|
000008f0  04 ec 05 3a 0d 04 f6 16  dd 20 f2 64 69 73 70 6c  |...:..... .displ|
00000900  61 79 5f 72 65 73 75 6c  74 73 0d 05 00 0a ea 20  |ay_results..... |
00000910  71 75 69 74 0d 05 0a 05  f5 0d 05 14 16 e3 20 73  |quit.......... s|
00000920  6f 72 74 25 3d 31 20 b8  20 73 6f 72 74 73 25 0d  |ort%=1 . sorts%.|
00000930  05 1e 0c f2 72 65 73 75  6c 74 73 0d 05 28 05 ed  |....results..(..|
00000940  0d 05 32 15 77 72 69 74  65 3d a3 3a 70 72 69 6e  |..2.write=.:prin|
00000950  74 65 72 3d a3 0d 05 3c  56 e7 20 73 6f 72 74 73  |ter=...<V. sorts|
00000960  25 3e 31 20 ef 20 33 31  2c 30 2c 32 32 2c 32 33  |%>1 . 31,0,22,23|
00000970  2c 31 2c 31 3b 30 3b 30  3b 30 3b 3a 71 75 69 74  |,1,1;0;0;0;:quit|
00000980  3d ac 20 a4 69 6e 70 75  74 28 22 44 69 73 70 6c  |=. .input("Displ|
00000990  61 79 20 72 65 73 75 6c  74 73 20 61 67 61 69 6e  |ay results again|
000009a0  22 29 20 8b 20 71 75 69  74 3d b9 0d 05 46 2c e7  |") . quit=...F,.|
000009b0  20 71 75 69 74 20 ef 20  32 33 2c 31 2c 31 3b 30  | quit . 23,1,1;0|
000009c0  3b 30 3b 30 3b 20 8b 20  ef 20 32 33 2c 31 2c 30  |;0;0; . . 23,1,0|
000009d0  3b 30 3b 30 3b 30 3b 0d  05 50 0a fd 20 71 75 69  |;0;0;0;..P.. qui|
000009e0  74 0d 05 5a 05 e1 0d 05  64 05 3a 0d 05 6e 0e dd  |t..Z....d.:..n..|
000009f0  20 f2 72 65 73 75 6c 74  73 0d 05 78 3b ea 20 66  | .results..x;. f|
00000a00  6e 61 6d 65 24 2c 6d 69  6e 5f 74 69 6d 65 25 2c  |name$,min_time%,|
00000a10  6d 61 78 5f 74 69 6d 65  2c 6d 61 78 5f 74 69 6d  |max_time,max_tim|
00000a20  65 25 2c 6d 65 61 6e 5f  74 69 6d 65 25 2c 70 6f  |e%,mean_time%,po|
00000a30  69 6e 74 25 0d 05 82 05  db 0d 05 8c 17 e7 20 70  |int%.......... p|
00000a40  72 69 6e 74 65 72 20 ef  20 32 2c 31 33 2c 31 33  |rinter . 2,13,13|
00000a50  0d 05 96 33 f1 27 6d 65  74 68 6f 64 24 28 73 6f  |...3.'method$(so|
00000a60  72 74 25 29 22 20 53 6f  72 74 20 28 74 69 6d 65  |rt%)" Sort (time|
00000a70  73 20 69 6e 20 63 65 6e  74 69 73 65 63 6f 6e 64  |s in centisecond|
00000a80  73 29 22 0d 05 a0 28 f1  27 22 4e 6f 2e 20 69 74  |s)"...(.'"No. it|
00000a90  65 6d 73 22 89 36 22 4d  69 6e 22 89 36 22 4d 61  |ems".6"Min".6"Ma|
00000aa0  78 22 89 35 22 4d 65 61  6e 22 27 0d 05 aa 66 e7  |x".5"Mean"'...f.|
00000ab0  20 77 72 69 74 65 20 66  6e 61 6d 65 24 3d 22 49  | write fname$="I|
00000ac0  2e 22 2b c0 6d 65 74 68  6f 64 24 28 73 6f 72 74  |."+.method$(sort|
00000ad0  25 29 2c 37 29 3a 63 68  61 6e 25 3d ae 28 66 6e  |%),7):chan%=.(fn|
00000ae0  61 6d 65 24 29 3a d5 23  63 68 61 6e 25 2c 34 38  |ame$):.#chan%,48|
00000af0  3a d5 23 63 68 61 6e 25  2c 34 34 3a d5 23 63 68  |:.#chan%,44:.#ch|
00000b00  61 6e 25 2c 34 38 3a d5  23 63 68 61 6e 25 2c 34  |an%,48:.#chan%,4|
00000b10  34 0d 05 b4 18 e3 20 70  6f 69 6e 74 25 3d 31 20  |4..... point%=1 |
00000b20  b8 20 70 6f 69 6e 74 73  25 0d 05 be 26 6d 69 6e  |. points%...&min|
00000b30  5f 74 69 6d 65 25 3d a4  63 61 6c 63 75 6c 61 74  |_time%=.calculat|
00000b40  65 28 22 6d 69 6e 22 2c  70 6f 69 6e 74 25 29 0d  |e("min",point%).|
00000b50  05 c8 26 6d 61 78 5f 74  69 6d 65 25 3d a4 63 61  |..&max_time%=.ca|
00000b60  6c 63 75 6c 61 74 65 28  22 6d 61 78 22 2c 70 6f  |lculate("max",po|
00000b70  69 6e 74 25 29 0d 05 d2  79 6d 65 61 6e 5f 74 69  |int%)...ymean_ti|
00000b80  6d 65 3d a4 63 61 6c 63  75 6c 61 74 65 28 22 6d  |me=.calculate("m|
00000b90  65 61 6e 22 2c 70 6f 69  6e 74 25 29 2f 73 65 74  |ean",point%)/set|
00000ba0  73 25 3a 6d 65 61 6e 5f  74 69 6d 65 25 3d a8 28  |s%:mean_time%=.(|
00000bb0  6d 65 61 6e 5f 74 69 6d  65 29 3a e7 20 6d 65 61  |mean_time):. mea|
00000bc0  6e 5f 74 69 6d 65 2d 6d  65 61 6e 5f 74 69 6d 65  |n_time-mean_time|
00000bd0  25 3e 3d 30 2e 35 20 6d  65 61 6e 5f 74 69 6d 65  |%>=0.5 mean_time|
00000be0  25 3d 6d 65 61 6e 5f 74  69 6d 65 25 2b 31 0d 05  |%=mean_time%+1..|
00000bf0  dc 2d f1 20 32 5e 70 6f  69 6e 74 25 2c 6d 69 6e  |.-. 2^point%,min|
00000c00  5f 74 69 6d 65 25 2c 6d  61 78 5f 74 69 6d 65 25  |_time%,max_time%|
00000c10  2c 6d 65 61 6e 5f 74 69  6d 65 25 0d 05 e6 2f e7  |,mean_time%.../.|
00000c20  20 77 72 69 74 65 20 f2  77 72 69 74 65 28 32 5e  | write .write(2^|
00000c30  70 6f 69 6e 74 25 29 3a  f2 77 72 69 74 65 28 6d  |point%):.write(m|
00000c40  65 61 6e 5f 74 69 6d 65  25 29 0d 05 f0 05 ed 0d  |ean_time%)......|
00000c50  05 fa 07 ef 20 33 0d 06  04 29 e7 20 77 72 69 74  |.... 3...). writ|
00000c60  65 20 d9 23 63 68 61 6e  25 3a f1 27 22 46 69 6c  |e .#chan%:.'"Fil|
00000c70  65 6e 61 6d 65 3a 20 22  3b 66 6e 61 6d 65 24 0d  |ename: ";fname$.|
00000c80  06 0e 31 e7 20 73 6f 72  74 73 25 3e 31 20 80 20  |..1. sorts%>1 . |
00000c90  73 6f 72 74 25 3c 3e 73  6f 72 74 73 25 20 80 20  |sort%<>sorts% . |
00000ca0  70 72 69 6e 74 65 72 3d  a3 20 f2 73 70 61 63 65  |printer=. .space|
00000cb0  0d 06 18 05 e1 0d 06 22  05 3a 0d 06 2c 17 dd 20  |.......".:..,.. |
00000cc0  a4 63 61 6c 63 75 6c 61  74 65 28 6d 24 2c 70 25  |.calculate(m$,p%|
00000cd0  29 0d 06 36 18 ea 20 73  65 74 25 2c 72 65 73 75  |)..6.. set%,resu|
00000ce0  6c 74 25 2c 74 69 6d 65  25 0d 06 40 2d e7 20 6d  |lt%,time%..@-. m|
00000cf0  24 3d 22 6d 69 6e 22 20  72 65 73 75 6c 74 25 3d  |$="min" result%=|
00000d00  32 31 34 37 34 38 33 36  34 37 20 8b 20 72 65 73  |2147483647 . res|
00000d10  75 6c 74 25 3d 30 0d 06  4a 14 e3 20 73 65 74 25  |ult%=0..J.. set%|
00000d20  3d 31 20 b8 20 73 65 74  73 25 0d 06 54 1e 74 69  |=1 . sets%..T.ti|
00000d30  6d 65 25 3d 74 69 6d 65  25 28 73 6f 72 74 25 2c  |me%=time%(sort%,|
00000d40  70 25 2c 73 65 74 25 29  0d 06 5e 2c e7 20 6d 24  |p%,set%)..^,. m$|
00000d50  3d 22 6d 69 6e 22 20 e7  20 74 69 6d 65 25 3c 72  |="min" . time%<r|
00000d60  65 73 75 6c 74 25 20 72  65 73 75 6c 74 25 3d 74  |esult% result%=t|
00000d70  69 6d 65 25 0d 06 68 2c  e7 20 6d 24 3d 22 6d 61  |ime%..h,. m$="ma|
00000d80  78 22 20 e7 20 74 69 6d  65 25 3e 72 65 73 75 6c  |x" . time%>resul|
00000d90  74 25 20 72 65 73 75 6c  74 25 3d 74 69 6d 65 25  |t% result%=time%|
00000da0  0d 06 72 25 e7 20 6d 24  3d 22 6d 65 61 6e 22 20  |..r%. m$="mean" |
00000db0  72 65 73 75 6c 74 25 3d  72 65 73 75 6c 74 25 2b  |result%=result%+|
00000dc0  74 69 6d 65 25 0d 06 7c  05 ed 0d 06 86 0c 3d 72  |time%..|......=r|
00000dd0  65 73 75 6c 74 25 0d 06  90 05 3a 0d 06 9a 12 dd  |esult%....:.....|
00000de0  20 f2 77 72 69 74 65 28  76 61 6c 25 29 0d 06 a4  | .write(val%)...|
00000df0  16 ea 20 62 79 74 65 25  2c 63 68 61 72 25 2c 73  |.. byte%,char%,s|
00000e00  74 72 24 0d 06 ae 10 73  74 72 24 3d c3 28 76 61  |tr$....str$=.(va|
00000e10  6c 25 29 0d 06 b8 17 e3  20 63 68 61 72 25 3d 31  |l%)..... char%=1|
00000e20  20 b8 20 a9 28 73 74 72  24 29 0d 06 c2 17 62 79  | . .(str$)....by|
00000e30  74 65 25 3d 97 c1 73 74  72 24 2c 63 68 61 72 25  |te%=..str$,char%|
00000e40  29 0d 06 cc 11 d5 23 63  68 61 6e 25 2c 62 79 74  |).....#chan%,byt|
00000e50  65 25 0d 06 d6 05 ed 0d  06 e0 10 d5 23 63 68 61  |e%..........#cha|
00000e60  6e 25 2c 97 22 2c 22 0d  06 ea 05 e1 0d 06 f4 05  |n%,.",".........|
00000e70  3a 0d 06 fe 1a f4 20 2b  2b 20 53 57 41 50 20 50  |:..... ++ SWAP P|
00000e80  52 4f 43 45 44 55 52 45  20 2b 2b 0d 07 08 05 3a  |ROCEDURE ++....:|
00000e90  0d 07 12 12 dd 20 f2 73  77 61 70 28 61 25 2c 62  |..... .swap(a%,b|
00000ea0  25 29 0d 07 1c 0b ea 20  74 65 6d 70 25 0d 07 26  |%)..... temp%..&|
00000eb0  13 74 65 6d 70 25 3d 64  61 74 61 25 28 61 25 29  |.temp%=data%(a%)|
00000ec0  0d 07 30 17 64 61 74 61  25 28 61 25 29 3d 64 61  |..0.data%(a%)=da|
00000ed0  74 61 25 28 62 25 29 0d  07 3a 13 64 61 74 61 25  |ta%(b%)..:.data%|
00000ee0  28 62 25 29 3d 74 65 6d  70 25 0d 07 44 05 e1 0d  |(b%)=temp%..D...|
00000ef0  07 4e 05 3a 0d 07 58 17  f4 20 2b 2b 20 42 55 42  |.N.:..X.. ++ BUB|
00000f00  42 4c 45 20 53 4f 52 54  20 2b 2b 0d 07 62 05 3a  |BLE SORT ++..b.:|
00000f10  0d 07 6c 11 dd 20 a4 42  75 62 62 6c 65 28 6e 25  |..l.. .Bubble(n%|
00000f20  29 0d 07 76 12 f2 62 75  62 62 6c 65 28 6e 25 29  |)..v..bubble(n%)|
00000f30  3a 3d 30 0d 07 80 05 3a  0d 07 8a 11 dd 20 f2 62  |:=0....:..... .b|
00000f40  75 62 62 6c 65 28 6e 25  29 0d 07 94 10 ea 20 69  |ubble(n%)..... i|
00000f50  25 2c 6a 25 2c 73 77 61  70 0d 07 9e 08 69 25 3d  |%,j%,swap....i%=|
00000f60  30 0d 07 a8 05 f5 0d 07  b2 0b 69 25 3d 69 25 2b  |0.........i%=i%+|
00000f70  31 0d 07 bc 0a 73 77 61  70 3d a3 0d 07 c6 17 e3  |1....swap=......|
00000f80  20 6a 25 3d 6e 25 20 b8  20 69 25 2b 31 20 88 20  | j%=n% . i%+1 . |
00000f90  2d 31 0d 07 d0 31 e7 20  64 61 74 61 25 28 6a 25  |-1...1. data%(j%|
00000fa0  29 3c 64 61 74 61 25 28  6a 25 2d 31 29 20 f2 73  |)<data%(j%-1) .s|
00000fb0  77 61 70 28 6a 25 2c 6a  25 2d 31 29 3a 73 77 61  |wap(j%,j%-1):swa|
00000fc0  70 3d b9 0d 07 da 05 ed  0d 07 e4 16 fd 20 73 77  |p=........... sw|
00000fd0  61 70 3d a3 20 84 20 69  25 3d 6e 25 2d 31 0d 07  |ap=. . i%=n%-1..|
00000fe0  ee 05 e1 0d 07 f8 05 3a  0d 08 02 16 f4 20 2b 2b  |.......:..... ++|
00000ff0  20 51 55 49 43 4b 20 53  4f 52 54 20 2b 2b 0d 08  | QUICK SORT ++..|
00001000  0c 05 3a 0d 08 16 12 dd  20 a4 51 75 69 63 6b 28  |..:..... .Quick(|
00001010  72 68 69 25 29 0d 08 20  15 f2 71 75 69 63 6b 28  |rhi%).. ..quick(|
00001020  31 2c 72 68 69 25 29 3a  3d 30 0d 08 2a 05 3a 0d  |1,rhi%):=0..*.:.|
00001030  08 34 17 dd 20 f2 71 75  69 63 6b 28 6c 6c 6f 25  |.4.. .quick(llo%|
00001040  2c 72 68 69 25 29 0d 08  3e 14 ea 20 6d 69 64 25  |,rhi%)..>.. mid%|
00001050  2c 6c 68 69 25 2c 72 6c  6f 25 0d 08 48 1f 6d 69  |,lhi%,rlo%..H.mi|
00001060  64 25 3d 64 61 74 61 25  28 28 6c 6c 6f 25 2b 72  |d%=data%((llo%+r|
00001070  68 69 25 29 20 81 20 32  29 0d 08 52 17 6c 68 69  |hi%) . 2)..R.lhi|
00001080  25 3d 72 68 69 25 3a 72  6c 6f 25 3d 6c 6c 6f 25  |%=rhi%:rlo%=llo%|
00001090  0d 08 5c 05 f5 0d 08 66  38 e7 20 64 61 74 61 25  |..\....f8. data%|
000010a0  28 72 6c 6f 25 29 3c 6d  69 64 25 20 f5 3a 72 6c  |(rlo%)<mid% .:rl|
000010b0  6f 25 3d 72 6c 6f 25 2b  31 3a fd 20 64 61 74 61  |o%=rlo%+1:. data|
000010c0  25 28 72 6c 6f 25 29 3e  3d 6d 69 64 25 0d 08 70  |%(rlo%)>=mid%..p|
000010d0  38 e7 20 64 61 74 61 25  28 6c 68 69 25 29 3e 6d  |8. data%(lhi%)>m|
000010e0  69 64 25 20 f5 3a 6c 68  69 25 3d 6c 68 69 25 2d  |id% .:lhi%=lhi%-|
000010f0  31 3a fd 20 64 61 74 61  25 28 6c 68 69 25 29 3c  |1:. data%(lhi%)<|
00001100  3d 6d 69 64 25 0d 08 7a  39 e7 20 72 6c 6f 25 3c  |=mid%..z9. rlo%<|
00001110  3d 6c 68 69 25 20 f2 73  77 61 70 28 72 6c 6f 25  |=lhi% .swap(rlo%|
00001120  2c 6c 68 69 25 29 3a 6c  68 69 25 3d 6c 68 69 25  |,lhi%):lhi%=lhi%|
00001130  2d 31 3a 72 6c 6f 25 3d  72 6c 6f 25 2b 31 0d 08  |-1:rlo%=rlo%+1..|
00001140  84 0f fd 20 72 6c 6f 25  3e 6c 68 69 25 0d 08 8e  |... rlo%>lhi%...|
00001150  21 e7 20 6c 6c 6f 25 3c  6c 68 69 25 20 f2 71 75  |!. llo%<lhi% .qu|
00001160  69 63 6b 28 6c 6c 6f 25  2c 6c 68 69 25 29 0d 08  |ick(llo%,lhi%)..|
00001170  98 21 e7 20 72 6c 6f 25  3c 72 68 69 25 20 f2 71  |.!. rlo%<rhi% .q|
00001180  75 69 63 6b 28 72 6c 6f  25 2c 72 68 69 25 29 0d  |uick(rlo%,rhi%).|
00001190  08 a2 05 e1 0d 08 ac 05  3a 0d 08 b6 16 f4 20 2b  |........:..... +|
000011a0  2b 20 53 48 45 4c 4c 20  53 4f 52 54 20 2b 2b 0d  |+ SHELL SORT ++.|
000011b0  08 c0 05 3a 0d 08 ca 10  dd 20 a4 53 68 65 6c 6c  |...:..... .Shell|
000011c0  28 6e 25 29 0d 08 d4 11  f2 73 68 65 6c 6c 28 6e  |(n%).....shell(n|
000011d0  25 29 3a 3d 30 0d 08 de  05 3a 0d 08 e8 10 dd 20  |%):=0....:..... |
000011e0  f2 73 68 65 6c 6c 28 6e  25 29 0d 08 f2 1a ea 20  |.shell(n%)..... |
000011f0  68 69 25 2c 69 25 2c 69  6e 74 25 2c 6c 6f 25 2c  |hi%,i%,int%,lo%,|
00001200  73 77 61 70 0d 08 fc 0b  69 6e 74 25 3d 6e 25 0d  |swap....int%=n%.|
00001210  09 06 05 f5 0d 09 10 11  69 6e 74 25 3d 69 6e 74  |........int%=int|
00001220  25 20 81 20 32 0d 09 1a  14 e3 20 69 25 3d 31 20  |% . 2..... i%=1 |
00001230  b8 20 6e 25 2d 69 6e 74  25 0d 09 24 16 6c 6f 25  |. n%-int%..$.lo%|
00001240  3d 69 25 3a 68 69 25 3d  69 6e 74 25 2b 69 25 0d  |=i%:hi%=int%+i%.|
00001250  09 2e 05 f5 0d 09 38 0a  73 77 61 70 3d a3 0d 09  |......8.swap=...|
00001260  42 46 e7 20 64 61 74 61  25 28 68 69 25 29 3c 64  |BF. data%(hi%)<d|
00001270  61 74 61 25 28 6c 6f 25  29 20 f2 73 77 61 70 28  |ata%(lo%) .swap(|
00001280  68 69 25 2c 6c 6f 25 29  3a 68 69 25 3d 6c 6f 25  |hi%,lo%):hi%=lo%|
00001290  3a 6c 6f 25 3d 6c 6f 25  2d 69 6e 74 25 3a 73 77  |:lo%=lo%-int%:sw|
000012a0  61 70 3d b9 0d 09 4c 15  fd 20 73 77 61 70 3d a3  |ap=...L.. swap=.|
000012b0  20 84 20 6c 6f 25 3c 3d  30 0d 09 56 05 ed 0d 09  | . lo%<=0..V....|
000012c0  60 0d fd 20 69 6e 74 25  3c 3d 30 0d 09 6a 05 e1  |`.. int%<=0..j..|
000012d0  0d ff                                             |..|
000012d2
SrtEval.m0
SrtEval.m1
SrtEval.m2
SrtEval.m4
SrtEval.m5