Sort structures because the representation is done in matrix?

4

Studying ordering methods, I realized that even the method receiving a vector, its graphical representation of how a method works and how it is explained in many materials is by using an array.

As in the example below:

(reference) .

Does this have to do with the ease of explanation of the operation or is it because the structure when performing the comparisons and moves treats the vector as matrix ?! I confess I was confused, some explanation?

    
asked by anonymous 25.08.2015 / 19:33

1 answer

6

This just seems to be an array, but it is not .

Each line is the vector state in step x of the ordering. That is, the position of each element in the array in a given step of the algorithm.

This representation is to show the algorithm step-by-step as it executes.

In the example you gave it, you are sorting the letters of the word EXAMPLE using the selection algorithm. The elements highlighted are the ones being used by the algorithm on each line

    
25.08.2015 / 19:38