Rest of Q-Sort

 BBS: Inland Empire Archive
Date: 12-10-92 (02:54)             Number: 361
From: JOHN SNEERINGER              Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: Rest of Q-Sort                 Conf: (2) Quik_Bas
            DO WHILE (J > I) AND (SortArray$(J) >= Partition$)
               J = J - 1

            IF I < J THEN
               SWAP SortArray$(I), SortArray$(J)
            END IF
         LOOP WHILE I < J

         SWAP SortArray$(I), SortArray$(High)

         IF (I - Low) < (High - I) THEN
            QuickSort Low, I - 1
            QuickSort I + 1, High
            QuickSort I + 1, High
            QuickSort Low, I - 1
         END IF
      END IF

FUNCTION RandInt% (Lower, Upper) STATIC

' =======================================================================
'   Returns a random integer greater than or equal to the Lower parameter
'   and less than or equal to the Upper parameter.
' =======================================================================

   RandInt% = INT(RND * (Upper - Lower + 1)) + Lower

 * Origin: RadioLink! Columbus, OH (614)766-2162
QuickBasic! HST/DS (1:226/140)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET