Ordering structures, why is the representation made in matrix?

Asked

Viewed 203 times

4

Studying methods of sorting, I realized that even the method receiving a vector, its graphical representation of the functioning and explanation of the method in many materials is using a matrix.

As in the example below:

inserir a descrição da imagem aqui

(reference).

This has to do with the ease of explanation of the functioning or is it because the structure when performing the comparisons and motions treats the vector as matrix?! I confess I was confused, some explanation?

1 answer

6


That’s just seems to be a matrix, but it’s not.

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

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

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

  • Thank you, in fact I’ve been kind of tired I hadn’t noticed that hehe

Browser other questions tagged

You are not signed in. Login or sign up in order to post.