Category : BASIC Source Code
Archive   : QB_CODE.ZIP
Filename : QSRTSNGI.BAS

 
Output of file : QSRTSNGI.BAS contained in archive : QB_CODE.ZIP

'
' QSRTSNGI.BAS - For the QuickBASIC Toolbox
' Quick Sort Indexed Single Precision Routine
'

'
' $INCLUDE: 'TOOLBOX.BI'
'

DEFINT A-Z

SUB QSORTSNGI (ARRAY!(), LEFT, RIGHT, INDEX())
IF RIGHT > LEFT THEN
I = LEFT - 1
J = RIGHT
DO
DO
I = I + 1
LOOP WHILE ARRAY!(I) < ARRAY!(RIGHT)
DO
J = J - 1
LOOP WHILE ARRAY!(J) > ARRAY!(RIGHT) AND J > LEFT
SWAP ARRAY!(I), ARRAY!(J)
SWAP INDEX(I), INDEX(J)
LOOP WHILE J > I
SWAP ARRAY!(I), ARRAY!(J)
SWAP ARRAY!(I), ARRAY!(RIGHT)
SWAP INDEX(I), INDEX(J)
SWAP INDEX(I), INDEX(RIGHT)
QSORTSNGI ARRAY!(), LEFT, I - 1, INDEX()
QSORTSNGI ARRAY!(), I + 1, RIGHT, INDEX()
END IF
END SUB