This does not look like sorting at all

I have a FAQ on quicksorting: faq314-336
The basic idea is that you want to re-order the elements to put the largest scores at the top. There are a number of ways to achieve this. If you don't want to set up a "complex" sorting routine like the quicksort, you can write a so-called "bubble" sort fairly easily. Be aware that the bubblesort is very inefficient, and this becomes apparent for larger numbers of elements (i.e., you would not want to run it on an array 5,000 elements long; it would probably take several minutes). Here is what a bubble sort might look like (look for the 'SUB bubbleSort' near the end):
[tt]
TYPE teamType
teamName
AS STRING * 10
teamScore
AS INTEGER
END TYPE
DIM team(1
TO 3)
AS teamType
setupTeams team()
PRINT "Before sorting:"
showStats team()
bubbleSort team()
PRINT "After sorting:"
showStats team()
END
SUB setupTeams(team()
AS teamType)
FOR i% =
LBOUND(team)
TO UBOUND(team)
team(i%).teamName = "Team " +
CHR$(i% -
LBOUND(team) + 65)
team(i%).teamScore =
INT(
RND * 30)
NEXT i%
END SUB
SUB showStats(team()
AS teamType)
FOR i% =
LBOUND(team)
TO UBOUND(team)
PRINT team(i%).teamName; ":"; team(i%).teamScore; "points"
NEXT i%
END SUB
SUB bubbleSort(team()
AS teamType)
FOR i% =
LBOUND(team)
TO UBOUND(team) - 1
FOR j% =
LBOUND(team)
TO UBOUND(team) - (i% -
LBOUND(team) + 1)
IF team(j%).score > team(j% + 1).score)
THEN SWAP team(j%), team(j% + 1)
NEXT j%
NEXT i%
END SUB
[/tt]
To see how this works, you have to look at what the inside [tt]j%[/tt] loop does. Each time through the loop, it starts at the beginning and goes up to an index value one less than the previous time. On each element, it compares it with the next one, and swaps them if they are out of order. With a little bit of thought, it can be seen how this will move the highest, followed by the next-highest, etc., up to the "top" of the list, while slowly "bubbling" the lower values down the list. Here is an example:
Starting with the following list:
3
7
2
4
5
..the comparisons & swaps performed by the bubblesort are as follows (comparisons are blue, comparisons w/ swaps are red):
First 'inner' loop:
3
7
2
4
5
3
7 2
2 7
4
5
3
2
7 4
4 7
5
3
2
4
7 5
5 7
Second 'inner' loop:
3 2
2 3
4
5
7
2
3
4
5
7
2
3
4
5
7
Third 'inner' loop:
2
3
4
5
7
2
3
4
5
7
Fourth and final 'inner' loop:
2
3
4
5
7
You can see that at the end of the first inner loop, the highest value has been moved to the end of the list. Though nothing is actually moved, you can also see that the last comparison of each of the other inner loops ends with the largest value up to that point in the correct position. More importantly, though, you can see that a lot of unnecessary comparisons are made by the bubblesort. This is part of the reason why it is so inefficient. For larger arrays, the quicksort should be used, and it is described, as mentioned earlier, in faq314-336