1 ' Shell Sorting Routine in BASIC 2 ' Max L. Seim (71116,1347) 3 ' 4 ' Array size only limited by memory. 5 ' Time it...compare sort speed to 6 ' other BASIC sorts...very fast! 7 ' 10 CLS:CLEAR2000:DIMA$(100) 15 N=1 17 PRINT"Enter words .... ENTER KEY to quit":PRINT 20 INPUTA$(N):IFA$(N)=""THEN30 25 N=N+1:GOTO20 30 GOSUB10000 46 FORI=1TOL:PRINTA$(I):NEXTI 50 END 60 ' 61 ' 62 ' 63 ' 10000 ' *** SHELL SORT ROUTINE *** 10010 M=N 10020 M=INT(M/2):IFM=0THENRETURN 10030 J=1:K=N-M 10040 I=J 10050 L=I+M:IFA$(I)<=A$(L)THEN10080 10060 T$=A$(I):A$(I)=A$(L):A$(L)=T$:I=I-M:IFI<1THEN10080 10070 GOTO10050 10080 J=J+1:IFJ>KTHEN10020 10090 GOTO10040 20000 ' 20005 ' 20010 ' 20020 ' === SHELL SORT ROUTINE === 20030 ' The shell sort routine is 20040 'one of many methods used for a 20050 'sorting of words/names. It is 20060 'almost twice as fast as the more 20070 'familiar BUBBLE SORT! 20080 ' 20090 ' The words in the sample 20100 'program are entered in array A$() 20105 'The SHELL SORT ROUTINE is called 20110 'and the sorted array is returned 20115 'as the array A$(). Very Simple. 20120 '...And the SHELL SORT ROUTINE is 20125 'only 9 lines long! 20130 ' Variables used: M,N,I,J,K,L,T$ 20135 ' Change variables if needed.