Category : Miscellaneous Language Source Code
Archive   : FORTRN77.ZIP
Filename : SORTS.FOR

 
Output of file : SORTS.FOR contained in archive : FORTRN77.ZIP
SUBROUTINE SORT(A,N)
C
C THIS SUBROUTINE PERFORMS AN IN PLACE SORT OF A
C ONE DIMENSIONAL ARRAY USING THE SHELL-METZNER
C METHOD.
C
C A = THE ARRAY TO BE SORTED TO ASCENDING ORDER
C N = THE NUMBER OF ELEMENTS IN THE ARRAY
C T = TEMPORARY ELEMENT HOLDER FOR SWAP
C
DIMENSION A(1)
C
K=N
5 IF (K.LE.1) GOTO 30
K=K/2
DO 20 J=1,N-K
DO 10 I=J,1,-K
IF (A(I).LE.A(I+K)) GO TO 10
T=A(I)
A(I)=A(I+K)
A(I+K)=T
10 CONTINUE
20 CONTINUE
GOTO 5
C
30 RETURN
END
C
C
C
SUBROUTINE SORT2(A,B,N)
C
C THIS SUBROUTINE PERFORMS AN IN PLACE SORT OF A
C ONE DIMENSIONAL ARRAY USING THE SHELL-METZNER
C METHOD. THEN MATCHES THAT ORDER IN A SECOND ARRAY
C
C A = THE ARRAY TO BE SORTED TO ASCENDING ORDER
C B = THE SECOND ARRAY TO BE ORDERED AS THE FIRST
C N = THE NUMBER OF ELEMENTS IN THE ARRAY
C T = TEMPORARY ELEMENT HOLDER FOR SWAP
C
DIMENSION A(1),B(1)
C
K=N
5 IF (K.LE.1) GOTO 30
K=K/2
DO 20 J=1,N-K
DO 10 I=J,1,-K
IF (A(I).LE.A(I+K)) GO TO 10
C FIRST ARRAY CONTROLS ORDER
T=A(I)
A(I)=A(I+K)
A(I+K)=T
C SECOND ARRAY
T=B(I)
B(I)=B(I+K)
B(I+K)=T
10 CONTINUE
20 CONTINUE
GOTO 5
C
30 RETURN
END


  3 Responses to “Category : Miscellaneous Language Source Code
Archive   : FORTRN77.ZIP
Filename : SORTS.FOR

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/