The Bubble Sort II Page

The Bubble Sort can be viewed as individual elements "bubbling" up to their proper positions. The "highest" one arrives at its position first, then the next highest, etc. Each execution of the while-do loop guarantees the correct placement of one element. This loop will be executed a minimum of once and a maximum of (elements - 1) times. Once all of the elements are in the appropriate order, the loop will be executed one more time unless it has already been executed the maximum number of times.

The Source

The Variables

1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45   46   47   48   49   NEXT  

The Output

The Source: The boolean variable is set to FALSE to enable entry into the while-do loop.


Back to Main Page
© 2002 DFStermole
Last Modified 5 Mar 2002