10 REM *** SHELL METZNER SORT ***
20 REM BY ALLAN D. EMERT
30 REM RT #4, BOX 1455, ODESSA, TX 79763
40 CLEAR 10000:DEFINT I-M:CLS
50 PRINT "   *** SHELL METZNER SORT ***"
60 PRINT:PRINT "BY ALLAN D. EMERT"
70 PRINT "RT #4, BOX 1455, ODESSA, TX 79763":PRINT
80 PRINT "TO END PROGRAM ENTER ///":DIM Z$(500)
90 N=N+1:PRINT "ITEM ";N;:INPUT Z$(N)
100 IF Z$(N)="///" GOTO 120
110 GOTO 90
120 N=N-1:M=N
130 M=M\2:IF M=0 GOTO 200
140 FOR J=1 TO N-M:I=J
150 L=I+M:IF Z$(I)<Z$(L) GOTO 190
160 A$=Z$(I):Z$(I)=Z$(L):Z$(L)=A$:I=I-M
170 IF I<1 GOTO 190
180 GOTO 150
190 NEXT:GOTO 130
200 PRINT:FOR I=1 TO N:PRINT Z$(I):NEXT
900 REM ------------------------
910 REM Changes for bwBASIC
920 REM 130 M=M/2 -> M=M\2
999 END

