1987/04/01 Arrojeria, Eustakio - Elhuyar Zientziaren Komunikazioa | Lizaso, Pili - Informatika SailaElhuyar Fundazioa Iturria: Elhuyar aldizkaria
At a time when sorting a list of numbers or letters has become a daily slogan, the programmer needs to find an immediate solution to this problem. On the other hand, any administrative program has a similar structure to that of this program. Therefore, taking this into account, we will proceed to its programming.
The method we will use is the usual and consists of:
Suppose we want to alphabetically sort the table as C A D E B. Now and starting your imagination, think that this table has been stacked in a table called T composed of five windows:
On the other hand, there is an alternative record called R.
It is initially empty.
The steps to follow are as follows:
- Take the first item in the list (T1=C)
- Initialize the process but with the letter in the box office T2 in this case.
See if it is before or after the next one. If it were earlier, it would have to be compared with the third. Instead, if it were in the background, they would have to be changed in order. The path used is as follows: Do the same with all letters. Thus, the letter that will appear in the box office T1 in alphabetical order will be the first.
So to finish all.
Thus, the program alphabetically orders the list. But when presenting the results we will put two lists, one without order and another ordered.
NOTE: If the list of words you want to sort is very long, you may need to use the (CLEAR) command to save the memory (on some computers). View computer manual of the order CLEAR.
Listing 10 REM
= 120$ ALPHABETICAL **