November 2002
Beginner
432 pages
11h 44m
English
Your programs can sort lists of values in different ways. Perhaps the list was sorted previously, and now you want to reverse the sort. A reversed sort may be appropriate, for example, to print customer balances from the highest balance to the lowest.
Consider the following list of numbers that is not sorted:
10 54 34 46 23
Here is the list sorted in ascending order (from lowest to highest):
10 23 34 46 54
Here is the list sorted in descending order (from highest to lowest):
54 46 34 23 10
Of course, your program can also sort character string data, such as a list of names. When sorting strings, the computer uses the ASCII table to sort the values in alphabetical order.
There are several ways to sort data. The most popular one for beginning ...