Sort alphabetically

Arrojeria, Eustakio

Elhuyar Zientziaren Komunikazioa

Lizaso, Pili

Informatika Saila

Elhuyar Fundazioa

We want to sort the table alphabetically. Now and starting your imagination, imagine that this table has been stacked in a table called T composed of five windows.

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)
    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.
  1. Initialize the process but with the letter in the box office T2 in this case.

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 **
20 CLEAR
30


PRINT











=



70


CLS
80





PRINT

Babesleak
Eusko Jaurlaritzako Industria, Merkataritza eta Turismo Saila