What does "sort an array" mean, either by rows or columns?

Asked

Viewed 165 times

1

What it means to "sort an array", whether by rows or columns?

  • Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).

1 answer

3

Probably a wrong way to say "classify each element of a row or column of an array". See What is the difference between ordered, unordered and Sorted?. Everyone speaks wrong. In order it is already, it is not classified. You cannot order something that already has an order. In English you would say Sorting to a Matrix, wouldn’t say Ordering.

So you take a sequence of values, probably numbers, which is in some order, analyze each one of them, bring to the beginning the smaller values, and send to the end the larger values, so at the end each next element will always be larger than the previous one, but the first the least of all and the last the greatest of all. It is also possible to classify downwards and the former is the largest and the latter the smallest.

If it is not numbers the classification is lexicographic, ie popularly alphabetical. If it is another type of data you have to determine how you classify.

One thing that can happen is to use more than one element as a criterion, so you would have to adopt a criterion, it could be just looking at the first element of the row or column, the sum, or something else.

Browser other questions tagged

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