If you've reached this stage, and you don't understand the bubble sort routine, or why it's called the bubble sort, then please go back and work it out. It may not seem important to you, but if this is so then you don't understand it!
Still with me ? How about a natural sort routine. If I gave you a set of numbers, you'd look through the list until you found the smallest number, then you'd put this number at the bottom of the list. Then you would look for the next smallest number, and place it just above the first smallest number. Makes sense dosen't it ( I hope ) ? As far as computer talk goes, this as called a selection ( or exchange ) sort.
A selection sort looks through the group of numbers, finds the smallest, and then swaps it with the last number in the list. The size of the list is then reduced by one to exclude the last number, and the routine moves onto the next smallest.
The BASIC program ( B.SELECT ) may not be as easy to understand as the B.BUBBLE program, but it follows the way that people sort more accurately. As before the arrangement of the numbers is shown after each pass of the sorting routine.